crontab
相关的文件
- /etc/crontab
相关文件夹
- /etc/cron.d
- /etc/cron.daily
- /etc/cron.hourly
- /etc/cron.monthly
- /etc.cron.weekly
命令用法
usage: crontab [-u user] file
crontab [ -u user ] [ -i ] { -e | -l | -r }
(default operation is replace, per 1003.2)
-e (edit user's crontab)
-l (list user's crontab)
-r (delete user's crontab)
-i (prompt before deleting user's crontab)
设置一个定时任务
一种方法:crontab -e
- 进入到定时任务编写
crontab -u root -e
- 添加定时命令
0 0 * * * reboot
第二种方法:编辑/etc/crontab文件
- vim进入到crontab文件
vim /etc/crontab
- 添加定时命令