linux下使用crontab定时执行脚本,简单实用
2020-04-21 22:08
477 查看
1、创建定时文件
touch crontab mytest.cron
2、创建运行文件
touch test.txt
3、编写定时任务
*/1 * * * * echo 'Hello World' >> /var/www/html/test.txt 2>&1(输出转化为标准输出,不写没事) # m h down mon dow command # 分 时 日 月 周 需要执行的脚本目录文件路径/命令行 >> 输出到的文件路径
4、执行定时任务文件
crontab mytest.cron
5、查看文件是否输出成功
crontab -l #查看定时任务是否成功或者检测/var/spool/cron下是否生成对应cron脚本 service crond status #查看 cron服务状态 service crond start #启动cron服务
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- 如何使用Linux的Crontab定时执行PHP脚本的方法
- linux下使用crontab定时执行脚本
- 使用crontab,让linux定时执行shell脚本【crontab -e】
- 如何使用Linux的Crontab定时执行PHP脚本的方法
- 工具 07 使用crontab,让linux定时执行shell脚本
- 使用crontab,让linux定时执行shell脚本
- 使用crontab,让linux定时执行shell脚本
- 在linux下定时执行PHP脚本(定时执行crontab使用方法详解)
- 如何使用Linux的Crontab定时执行PHP脚本的方法
- 如何使用Linux的Crontab定时执行PHP脚本的方法
- 使用crontab,让linux定时执行shell脚本
- 如何使用Linux的Crontab定时执行PHP脚本的方法
- 使用crontab,让linux定时执行shell脚本
- linux中使用crontab定时执行程序(PHP脚本.sh等等各种)
- 使用Linux的Crontab定时执行PHP脚本
- Crontab的简单使用和创建第一个自动定时任务执行python脚本
- Linux中使用crontab命令定时执行shell脚本或其他Linux命令
- 在linux下定时执行PHP脚本(定时执行crontab使用方法详解)
- 使用Linux的Crontab定时执行PHP脚本
- linux下使用crontab定时执行python脚本