首页 > 技术文章 > linux shell定时任务

zf-crazy 2021-02-01 09:59 原文

1.用到crontab,需要初始化命令包
yum install vixie-cron
yum install crontabs
2.启动服务
systemctl start crond.service
3.编写shell文件
#/bin/sh
echo "test" >> /home/app/log.txt
保存 test.shell
4.进入编写定时触发器
crontab -e (类似于vi文件操作)
52 9 * * * sh /home/app/test.shell
:wq 退出
只出现crontab: installing new crontab 表示设置成功 5. tail -f log.txt 监听文件.....

  

推荐阅读