环境Ubuntu16.04
Ubuntu自带Crontab,不用安装。
1.开启Crontab日志
vi /etc/rsyslog.d/50-default.conf
把#cron.*前面的#号去掉
重启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
每分钟执行这个文件中的shell命令。
第一次选择编辑器
如果之前选错了修改执行select-editor
查看是否执行
cd /app
tail -f testcrontab.txt