mynotes cronjob
By Pravin•
open a crontab
crontab -e
Run everyday
# every week day 0 9 * * * /home/ubuntu/novanenv/bin/python /path/to/your/script.py >> /path/to/your/logfile.log 2>&1 # every working day 0 9 * * 1-5 /home/ubuntu/novanenv/bin/python /path/to/your/script.py >> /path/to/your/logfile.log 2>&1 # weekly once on monday 0 9 * * 1 /home/ubuntu/novanenv/bin/python /path/to/your/script.py >> /path/to/your/logfile.log 2>&1
| Position | Name | Value Range | Description |
|---|---|---|---|
| 1st | Minute | 0-59 | Specific minute.0 = Top of the hour.30 = Half past.* = Every single minute. |
| 2nd | Hour | 0-23 | 24-hour format.0 = Midnight.9 = 9 AM.13 = 1 PM.23 = 11 PM. |
| 3rd | Day of Month | 1-31 | Specific Calendar Date. Use this if you want to run on the "1st of the month" or "15th of the month". |
| 4th | Month | 1-12 | The Month. Use this to run only in "December" or "January". |
| 5th | Day of Week | 0-6 | The Weekly Cycle.0 or 7 = Sunday1 = Monday5 = Friday |
once cronjob changes are done, restart the cron
sudo systemctl status cron sudo systemctl stop cron sudo systemctl start cron sudo systemctl restart cron
check cronjob errors
grep CRON /var/log/syslog
Comments
No comments yet. Be the first to comment!
Leave a Comment
Your comment will be visible after approval.