环境Ubuntu16.04

Ubuntu自带Crontab,不用安装。

1.开启Crontab日志

vi /etc/rsyslog.d/50-default.conf

把#cron.*前面的#号去掉

Ubuntu使用Crontab

重启rsyslog服务

service rsyslog restart

然后再重启crontab服务

service cron restart

创建接收crontab输出的文件

cd /app

touch /app/testcrontab.txt

配置crontab

crontab -e

* * * * * echo "test crontab is work or not" >> /app/testcrontab.txt

Ubuntu使用Crontab

每分钟执行这个文件中的shell命令。

第一次选择编辑器

Ubuntu使用Crontab

如果之前选错了修改执行select-editor

查看是否执行

cd /app

tail -f testcrontab.txt

Ubuntu使用Crontab

 

相关文章:

  • 2022-01-08
  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
  • 2022-01-21
  • 2022-12-23
  • 2021-12-10
  • 2021-12-20
猜你喜欢
  • 2022-12-23
  • 2022-01-13
  • 2021-05-15
  • 2021-12-01
  • 2021-06-02
  • 2022-02-21
  • 2021-11-01
相关资源
相似解决方案