Linux定时任务,文本追加内容

每分钟向文本追加内容

1,编写Shell脚本 test.sh 并且放到 root目录下

文本内容为

/bin/echo "你好" >> /root/test.txt

2,编辑定时任务

crontab -e

*/1 * * * * /root/test.sh

3,查看定时任务  crontab -l

4,删除定时任务 crontab -r

注意 若文件 test.sh 没有权限

更改文件权限

chmod 777 test.sh

转载于:https://www.jianshu.com/p/8a691baf4794

猜你喜欢

转载自blog.csdn.net/weixin_33819479/article/details/91071451
今日推荐