centos7下cron命令

来源:互联网 发布:表示网站域名的是 编辑:程序博客网 时间:2024/06/07 12:24

目标:每分钟将hello world字符串写入文件

实现:

设置定时:vi /etc/crontab

增加:*/1 * * * * root echo "hello world." >> /hello.txt  (注意root一定要添加,否则start失败)

启动定时:/bin/systemctl start crond

启动后查看状态:/bin/systemctl status crond

关闭定时:/bin/systemctl stop crond

重启定时:/bin.systemctl restart crond