Hi I've got a python3 routine in the following location: /home/myusername/public_html/cgi-bin/routine.py I've then uploaded a file called crontab.txt to the same directory with the code:
If I then go to the cgi-bin directory using SSH and run the command
I get the response: "crontab.txt":1: premature EOF errors in crontab file, can't install. Where am I going wrong please? Also, with the above timings I hope to run the routine at 0,10,20.... mins past the hour. Will this happen or might it run at 02,12,22... mins past the hour? thanks John asked 26 Feb '16, 19:19 santon |
I see a couple of problems:
You can fix both problems with the following command:
The schedule above will run at 10 minute intervals, starting at :00 and every 10 minutes thereafter. answered 27 Feb '16, 00:53 seanf |
Hi I still cannot get the cron job to run. I have discovered that python3 was in a different folder to that which I had thought. I have also set the routine to run every minute but it does not seem to be running and logs are not being created. I have the following code in my crontab file.
I am assuming that the command to get the cronjob (named crontab.txt) to run is:
The weird things is that if I type the following into putty:
then the routine runs. This seems to prove that my path is correct. The only difference between doing it manually and using the cron routine is that doing it manually I start with python3 ... Does this suggest that my cron code is not forcing it to run using python3 but that it is trying to use python2 and failing? Any ideas as to how to troubleshoot please? answered 29 Feb '16, 11:44 santon Can you please open a support ticket from your WebFaction hosting control panel, so that we can check this further? You can create the ticket using the following URL:
(29 Feb '16, 13:00)
dimitari
|
I had a similar issue running in 2.7 from crontab: ended calling a script in the same directory as my app. This is what I'm doing (mostly unoriginal work which I probably I cobbled together from answers here on stackexchange).
I then call the script from crotab thusly:
Ended up working out better because with the limited env run by cron I needed to initiate some env vars before i called python anyway. hope this helps answered 01 Mar '16, 15:15 spam |
Hi Thanks for the input. Eventually Webfaction support found some spurious characters that had been generated by notepad but which were not visible. After they fixed it I needed to alter the frequency of the cron job and had the same issue again. I fixed it by running dos2nux myroutine.py This sorted it out. answered 01 Mar '16, 16:58 santon |