Crontab

命令格式

1
2
m      h    dom        mon   dow       command
minute hour dayOfMonth Month dayOfWeek commandToRun

定时任务示例命令

启动任务

1
@reboot root /boot.sh

定时关机

示例

1
0 4   *   *   *    /sbin/shutdown -r +5

Usage

Example add task by Bash

1
2
3
4
5
6
7
#write out current crontab
crontab -l > mycron
#echo new cron into cron file
echo "00 09 * * 1-5 echo hello" >> mycron
#install new cron file
crontab mycron
rm mycron