1. Linux环境下定时
建立命令:
crontab -e
* * * * * command
分 时 日 月 周
查看命令: (补充: 查看定时器执行结果命令-----------tail cron*)
crontab -l
暂停:
# * * * * * command
删除:
crontab -e
删除执行命令的代码
2. 定时规则
分 1-59
时 0-23
日 1-31
月 1-12
周 0-6 0:周日 6:周日
例如: 每隔1分钟记录一次时间,并输出到指定文件(cronRecord.sh)中
*/1 * * * * date>>/home/lxh/monitor/cronRecord.sh
任务执行以前cronRecord.sh内容
任务执行以后cronRecord.sh内容