5 examples for crontab

{{ score }}
  #Edit crontab for current user
#
#Allows bro to add cron job scheduled command
#Entries added in the following format:
# * * * * *  command to execute
# | | | | |
# | | | | |
# | | | | |------ day of week (0 - 6) (0 to 6 are Sunday to Saturday, 7 is Sunday, the same as 0)
# | | | |------------- month (1 - 12)
# | | |--------------------- day of month (1 - 31)
# | |------------------------------ hour (0 - 23)
# |------------------------------------- min (0 - 59)
#
# e.g.
# 15 * * * * ~./brofist
# Would run the brofist command once an hour on the 15th minute of every hour
crontab -e
        
{{ score }}
  #List crontab for current user
crontab -l
        
{{ score }}
  # Add crontab from from STDIN
echo "* * * * * /my-script.sh" | crontab -
        
{{ score }}
  # Copy and paste this to add to your crontab
# * * * * * *
# | | | | | |
# | | | | | +-- Year              (range: 1900-3000)
# | | | | +---- Day of the Week   (range: 1-7, 1 standing for Monday)
# | | | +------ Month of the Year (range: 1-12)
# | | +-------- Day of the Month  (range: 1-31)
# | +---------- Hour              (range: 0-23)
# +------------ Minute            (range: 0-59)
#
#
# Examples
# * * * * * *                         Each minute
# 59 23 31 12 5 *                     One minute  before the end of year if the last day of the year is Friday
# 59 23 31 DEC Fri *                  Same as above (different notation)
# 45 17 7 6 * *                       Every  year, on June 7th at 17:45
# 45 17 7 6 * 2001,2002               Once a   year, on June 7th at 17:45, if the year is 2001 or  2002
# 0,15,30,45 0,6,12,18 1,15,31 * 1-5 *  At 00:00, 00:15, 00:30, 00:45, 06:00, 06:15, 06:30,
#                                    06:45, 12:00, 12:15, 12:30, 12:45, 18:00, 18:15,
#                                    18:30, 18:45, on 1st, 15th or  31st of each  month, but not on weekends
# */15 */6 1,15,31 * 1-5 *            Same as above (different notation)
# 0 12 * * 1-5 * (0 12 * * Mon-Fri *) At midday on weekdays
# * * * 1,3,5,7,9,11 * *              Each minute in January,  March,  May, July, September, and November
# 1,2,3,5,20-25,30-35,59 23 31 12 * * On the  last day of year, at 23:01, 23:02, 23:03, 23:05,
#                                    23:20, 23:21, 23:22, 23:23, 23:24, 23:25, 23:30,
#                                    23:31, 23:32, 23:33, 23:34, 23:35, 23:59
# 0 9 1-7 * 1 *                       First Monday of each month, at 9 a.m.
# 0 0 1 * * *                         At midnight, on the first day of each month
# * 0-11 * * *                        Each minute before midday
# * * * 1,2,3 * *                     Each minute in January, February or March
# * * * Jan,Feb,Mar * *               Same as above (different notation)
# 0 0 * * * *                         Daily at midnight
# 0 0 * * 3 *                         Each Wednesday at midnight
        
{{ score }}
  # crobtab for root/sudo require script, edit in terminal, this command will excute without require prompt password
# @yearly ->run once a year at midnight of 1 January
# @monthly -> first day of month
# weekly ->once a week at sunday midnight morning
# @daily/@midnight -> once a day
# @reboot -> at start-up, better than rc.local(touch too deep at system level) or init.d/(cannot excute with root)
# or any normal time format like above
sudo crontab -e
@yearly/@monthly/..etc command