Originally Posted by guitarscn
I cannot seem to start dns.py.
Beginning with the following:
print 'start : %s' % time.ctime()
print 'end : %s' % time.ctime()
Assuming this is saved as sleep.py
- Ensure the file is executable:
$ ls -l sleep.py
-rwxr-xr-x 1 me users 119 Nov 7 18:41 sleep.py
- Ensure the availability of the interpreter:
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.
$ which python
- 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).
$ 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)
Whenever I boot up my machine and check ps aux, it's not on there.
- Do you see "dns" echoed during boot?
If not, dns.py is not found on this path or it is not executable.
if [ -x /usr/local/bin/dns.py ]; then
echo -n ' dns';
/usr/local/bin/dns.py >/dev/null 2>&1 &
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: