Answers for "crontab"

2

crontab comment

# This is a comment
0 0 * * * /usr/bin/magiccronjob
Posted by: Guest on September-09-2020
5

syntax crontab

# 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
Posted by: Guest on February-19-2021
3

cron

# 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-name  command to be executed

# Set the hardware clock to keep it in sync with the more accurate system clock
03 05 * * * /sbin/hwclock --systohc

# Perform monthly updates on the first of the month
# 25 04 1 * * /usr/bin/dnf -y update
Posted by: Guest on December-19-2020
25

crontab

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)
Posted by: Guest on March-20-2021
5

crontab

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- weekday (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  *  user command to be executed
10 * * * * /bin/sh backup.sh    # every hour at 10"
Posted by: Guest on August-07-2021
0

*/1 in crontab

*/1 means exactly the same as *
Posted by: Guest on September-23-2020

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language