I need to set up cron job for python script scheduled at 08:00 15:00 and 18:00 IST
My python location is
/usr/bin/python3
and script location is
~/Documents/Python/script.py
I have tried the following solutions:
but not working.
I need to set up cron job for python script scheduled at 08:00 15:00 and 18:00 IST
My python location is
/usr/bin/python3
and script location is
~/Documents/Python/script.py
I have tried the following solutions:
but not working.
This information is not as easy to find as usual, but the full documention can be viewed by doing:
man 5 crontab
which reveals this:
field allowed values
----- --------------
minute 0-59
hour 0-23
day of month 1-31
month 1-12 (or names, see below)
day of week 0-7 (0 or 7 is Sun, or use names)
There is also a reminder of these fields at the top of every new crontab, but you may have deleted that:
# m h dom mon dow command
So, in order to run your script at 8:00, 15:00 and 18:00 on weekdays, do
0 8,15,18 * * 1-5 /usr/bin/python3 /home/[username]/Documents/Python/script.py
where 1-5
means Monday through Friday.
You need to fill in your own username, as cron
does not understand the ~
shortcut.
0 8,15,19 * * 1-5 /usr/bin/python /home/[username]/Documents/Python/script.py
– Akshat Zala May 07 '20 at 14:12