where is crontab file code example

Example 1: export crontab

# Create the backup (export):
crontab -l > /some/shared/location/crontab.bak
# Import it from the new user:
crontab /some/shared/location/crontab.bak

Example 2: crontab file location

/var/spool/cron/crontabs

Example 3: 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

Example 4: */1 in crontab

*/1 means exactly the same as *

Tags:

Misc Example