[code lang=”python”]
import os
os.system("dir c:")
[/code]
Monthly Archives: May 2010
อ่าน-เขียนไฟล์ด้วย Python
เชียนไฟล์
f = open(‘/tmp/workfile’, ‘w’)
อ่านไฟล์
f.read()
อ่านไฟล์เป็นบรรทัด
f.readline()
ตัวอย่างการใช้ pickle http://docs.python.org/library/pickle.html
ที่มา: daimi.au.dk/~besen/TBiB2007/lecture-notes/persistence.html, docs.python.org/tutorial/inputoutput.html
Ubuntu: Run a system command automatically at startup
กำหนดคำสั่งที่จะเรียกใช้ (ในที่นี้คือ /home/user/command) ไว้ใน crontab ดังนี้
1 2 |
sudo crontab -e @reboot /home/user/command |
หรือจะพิมพ์คำสั่งไว้ใน text ไฟล์ แล้วใช้คำสั่ง crontab textfile ก็ได้
ที่มา: help.ubuntu.com/6.10/ubuntu/desktopguide/C/ch10s04.html
Start Bind9 บน Ubuntu
วิธี Start Bind
sudo /etc/init.d/bind9 start
ที่มา: BIND9ServerHowto, Install, Config