Linux定时操作
f1 f2 f3 f4 f5 绝对目录地址文件
* * * * *
- - - - -
| | | | |
| | | | +----- 星期中星期几 (0 - 6) (星期天 为0)
| | | +---------- 月份 (1 - 12)
| | +--------------- 一个月中的第几天 (1 - 31)
| +-------------------- 小时 (0 - 23)
--------------------- 分钟 (0 - 59)
创建脚本 vi mycron.sh
写入
#/bin/bash/
date >> time.info
添加定时任务
[root@localhost ~] crontab -e
写入
* * * * * /root/mycron.sh
打开一个新终端,查看time.info文件
root@localhost ~]# tail -f time.info
2021年 05月 26日 星期三 09:55:33 CST
2021年 05月 26日 星期三 09:55:40 CST
2021年 05月 26日 星期三 09:57:02 CST
2021年 05月 26日 星期三 09:57:10 CST
2021年 05月 26日 星期三 09:57:11 CST
2021年 05月 26日 星期三 09:57:12 CST
2021年 05月 26日 星期三 09:57:13 CST