cron英文意思:計劃任務,咱們常常使用的是crontab命令是cron table的簡寫,它是cron的配置文件,也能夠叫它做業列表,咱們能夠在如下文件夾內找到相關配置文件。java
咱們經常使用的命令以下:vim
crontab [-u username] //省略用戶表表示操做當前用戶的crontab -e (編輯工做表) -l (列出工做表裏的命令) -r (刪除工做做)
咱們用crontab -e進入當前用戶的工做表編輯,是常見的vim界面。每行是一條命令。url
crontab的命令構成爲 時間+動做,其時間有分、時、日、月、週五種,操做符有rest
* * * * * myCommand
3,15 * * * * myCommand
3,15 8-11 * * * myCommand
3,15 8-11 */2 * * myCommand
3,15 8-11 * * 1 myCommand
30 21 * * * /etc/init.d/smb restart
45 4 1,10,22 * * /etc/init.d/smb restart
10 1 * * 6,0 /etc/init.d/smb restart
0,30 18-23 * * * /etc/init.d/smb restart
0 23 * * 6 /etc/init.d/smb restart
* */1 * * * /etc/init.d/smb restart
* 23-7/1 * * * /etc/init.d/smb restart