First of all I am not very familiar with cron
... Under .../cron/crontabs
I have a file (which is called root
, not sure whether it needs to be the same as the user?) with one job:
* * * * * sleep 0; wget -0 /var/cache/file.txt 'IP-ADDRESS'
* * * * * sleep 10; wget -0 /var/cache/file.txt 'IP-ADDRESS'
* * * * * sleep 20; wget -0 /var/cache/file.txt 'IP-ADDRESS'
...
And this works: it downloads the contents of the IP address and saves into my file every 10 seconds. There are other three commands with sleep
30, 40 and 50.
Now I want to add another job that executes a python script every 10 seconds.
I tried to create a new file under .../cron/crontabs
, which I called job2
but nothing happened.
- can I just create as many cron scripts as I want? Do I need to start them somehow?
Since this did not work, I tried to add my second job to the existing root
file, which now reads:
* * * * * sleep 0; wget -0 /var/cache/file.txt 'IP-ADDRESS'
* * * * * /home/user/Documents/pythonscript
* * * * * sleep 10; wget -0 /var/cache/file.txt 'IP-ADDRESS'
* * * * * /home/user/Documents/pythonscript
* * * * * sleep 20; wget -0 /var/cache/file.txt 'IP-ADDRESS'
* * * * * /home/user/Documents/pythonscript
...
where pythonscript
is an executable, and I made sure that the cron folder has permissions to the python script path...
- This still does not work. How do I make cron execture a python script?