NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
PatrikL
Oct 12, 2011Aspirant
Not getting cron to work
I've tried to get a script (importing torrent files from rss) executed once an hour by simply placing it in cron.hourly but nothing whatsoever happens. The script executes well manually when I'm logge...
WhoCares_
Oct 13, 2011Mentor
Sorry to interrupt once again but I guess the inital problem is the usage of the /usr/bin/env hack. That's because by default a cron shell will get passed an almost empty environment (which is why in the general crontab the PATH variable is set explicitly). Depending on the version of cron used it is not guaranteed that the information contained in the general crontab file is passed to jobs that are run from the cron.d directory.
So running #!/usr/bin/env python will most likely fail because there is no PATH to be searched, resulting in the script being interpreted by /bin/sh. And that in turn leads to the error with unknown import command. To fix this and to be able to run python scripts directly without having to write a wrapper all the time you could either replace the #!/usr/bin/env python with just #!/usr/bin/python or add a PATH="whatever path configuration you need" to the head of the cronjob definition file.
-Stefan
So running #!/usr/bin/env python will most likely fail because there is no PATH to be searched, resulting in the script being interpreted by /bin/sh. And that in turn leads to the error with unknown import command. To fix this and to be able to run python scripts directly without having to write a wrapper all the time you could either replace the #!/usr/bin/env python with just #!/usr/bin/python or add a PATH="whatever path configuration you need" to the head of the cronjob definition file.
-Stefan
Related Content
NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!