Quote:
Originally Posted by guitarscn
I cannot seem to start dns.py.
|
Let's experiment.
Beginning with the following:
Code:
#!/usr/local/bin/python
import time
print 'start : %s' % time.ctime()
time.sleep(10)
print 'end : %s' % time.ctime()
Assuming this is saved as
sleep.py:
- Ensure the file is executable:
Code:
$ ls -l sleep.py
-rwxr-xr-x 1 me users 119 Nov 7 18:41 sleep.py
- Ensure the availability of the interpreter:
Code:
$ which python
/usr/local/bin/python
By default, the Python binary is installed with the version number. Unless a symbolic link has been created with ln(1), this may be a reason why the script cannot be executed.
- Likewise, the path returned by which(1) must match the first line of the script unless the script is run as a command-line argument.
- Execute the script above, & while it running, check ps(1).
Code:
$ ps aux | grep python
me 32464 4.1 0.2 1948 3968 p0 S+ 6:58PM 0:00.08 /usr/local/bin/python ./sleep.py (python2.6)
me 24570 0.0 0.0 472 4 p1 R+ 6:58PM 0:00.00 grep python (ksh)
$
-
Quote:
Whenever I boot up my machine and check ps aux, it's not on there.
|
Two questions:- Do you see "dns" echoed during boot?
Code:
if [ -x /usr/local/bin/dns.py ]; then
echo -n ' dns';
/usr/local/bin/dns.py >/dev/null 2>&1 &
fi
If not, dns.py is not found on this path or it is not executable.
You can also test the above code independently of rc.local (complete with enclosing if-statement...).
- How long does dns.py take to execute?
- Because this script is being started automatically, you will want to change ownership to root.
Beyond this, you need to provide more details.
I also invite you to review the following:
http://www.daemonforums.org/showthread.php?t=596