Skip to content

Instantly share code, notes, and snippets.

@brokendish
Created January 22, 2012 12:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brokendish/1656725 to your computer and use it in GitHub Desktop.
Save brokendish/1656725 to your computer and use it in GitHub Desktop.
VPS側のcrontab
# m h dom mon dow command
#書式
#<分> <時> <日> <月> <曜日> <コマンド>
#<分> 0~59までの整数
#<時> 0~23までの整数
#<日> 1~31までの整数
#<月> 1~12までの整数
#<曜日> 0~7までの整数 (0,7 : 日曜~6:土曜日)
#<コマンド> 実行するコマンド,シェルスクリプトなど。
#--------------------------------------------------------
#(日次例) 23時45分に毎日実行
#45 23 * * *
#(週次例) 月曜日の9時と12時に実行 (複数の値を指定しているので,","で9時と12時を区切。
#0 9,12 * * 1
#(2時間毎) 2時間毎にジョブを実行 (2分,2時間などと設定する場合は,"*/2"のように設定します。
#0 */2 * * *
#--------------------------------------------------------
#1日〜7日までの日曜日(%w=0)の3時に実行:第1日曜日
#0 3 1-7 * * test $(date +\%w) -eq 0 && /hoge/hoge/tools/all-sys-bkup.sh
#8日〜14日までの日曜日(%w=0)の3時に実行:第2日曜日
0 3 8-14 * * test $(date +\%w) -eq 0 && /hoge/hoge/tools/all-sys-bkup.sh
#15日〜21日までの日曜日(%w=0)の3時に実行:第3日曜日
#0 3 15-21 * * test $(date +\%w) -eq 0 && /hoge/hoge/tools/all-sys-bkup.sh
#22日〜28日までの日曜日(%w=0)の3時に実行:第4日曜日
0 3 22-28 * * test $(date +\%w) -eq 0 && /hoge/hoge/tools/all-sys-bkup.sh
#29日〜31日までの日曜日(%w=0)の3時に実行:第5日曜日
0 3 29-31 * * test $(date +\%w) -eq 0 && /hoge/hoge/tools/all-sys-bkup.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment