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...
PatrikL
Oct 13, 2011Aspirant
WhoCares? wrote: 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
Sorry Stefan I never wrote how my original script started and that was with:
#!/usr/bin/python
That never worked either and the error messages indicates that that line wasnt understod.
Despite the script now working when executed from /bin/sh, cron doesnt seem to run it or if it does and it fails, nothing is logged... I'll have some further looks later tonight but as I said earlier Transmission constantly crashing on smoe torrents is a bigger issue for me now anyway :-(
Related Content
NETGEAR Academy

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