crontab example
# This is a comment
0 0 * * * /usr/bin/magiccronjob
3.63
8
//Specify cron frequency
//e.g. run minute 0, every hour
0 */1 * * *
//enter a bash command to the script input field
//e.g. a wget command where the output isn't saved
wget -O- url_here >> /dev/null
Thank you!
8
0
4
7
crontab -e # to edit (then 'i': insert, ':wq!': save and quit)
10 * * * * /bin/sh backup.sh # every hour at 10"
0 */4 * * * /bin/sh backup.sh # every 4 hours at 0"
0 9-17 * * * /bin/sh backup.sh # every hour at 0" between 9 and 17
0 2 * * * /bin/sh backup.sh # daily at 2am
0 0 * * MON /bin/sh backup.sh # every Monday at 0am
0 0 * * 1-5 /bin/sh backup.sh # daily from Monday to Friday at 0am
0 0 * * 0 /bin/sh backup.sh # weekly on Sunday
0 0 1 * * /bin/sh backup.sh # monthly (1rst day at 0am)
0 0 1 */3 * /bin/sh backup.sh # every quarter (1rst day at 0am)
0 0 1 1 * /bin/sh backup.sh # yearly (01/01)
Thank you!
7
0
3.8
10
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user command to be executed
example :
# 50 12 * * * ----- run every day at 12.50
# */5 * * * * ----- run every 5 minutes
Thank you!
10
0
Are there any code examples left?
New code examples in category Shell/Bash
-
Shell/Bash 2022-03-27 22:30:33 wise highlight ubuntu
-
Shell/Bash 2022-03-27 22:25:19 how to send a pull request in git
-
Shell/Bash 2022-03-27 21:55:06 how to open terminal in sublime text ubuntu
-
Shell/Bash 2022-03-27 21:25:19 how to switch branch
-
Shell/Bash 2022-03-27 21:20:25 python
-
Shell/Bash 2022-03-27 21:20:04 set user as admin gitlab
-
Shell/Bash 2022-03-27 21:10:09 apache2 mod_jk proxy to tomcat connector
-
Shell/Bash 2022-03-27 20:35:12 chown
-
Shell/Bash 2022-03-27 20:15:08 awk last match