I'm having a problem with cron: after a NAS restart, some commands in crontab file do not work. Some do, some don't. In order to make them work, I have to log in NAS (SSH) and restart the cron service:
Code: Select all
/etc/init.d/crond.sh restart
Here it goes.
I run 2 Python interpreters: Python 2.7, installed via official QPKG package, and Python 2.7.3, installed via ipkg. I need v2.7.3 because some python modules are not available with earlier releases.
I wrote 2 scripts, each using a different python interpreter. The only thing they do is output the current date / time to a file.
/share/scripts/test27.py - uses the 2.7 interpreter - QPKG package
Code: Select all
#!/usr/bin/env python2.7
import datetime
open("/share/scripts/test27.txt", "a").write("%s\n" % datetime.datetime.now())
Code: Select all
#!/usr/bin/env python2
import datetime
open("/share/scripts/test2.txt", "a").write("%s\n" % datetime.datetime.now())
Code: Select all
* * * * * /share/scripts/test2.py
* * * * * /share/scripts/test27.py
After a while, both /share/scripts/test27.txt and /share/scripts/test2.txt start to update (as expected - both scripts are run via cron).
I reboot the NAS, and only test27.txt updates - that means cron is not running the the script using the ipkg interpreter. After I login NAS and restart the cron service, both files (test27.txt and test2.txt) start updating, meaning both scripts are run by cron.
Can you help me solve the problem?