安装 crontab
yum install vixie-cron
yum install crontabs
开机启动
chkconfig crond on
查看状态
systemctl status crond
启动
systemctl start crond
停止
systemctl stop crond
编写脚本
vim /root/script/docker_clean.sh
#!/bin/bash
docker image prune -a -f
docker images
新增定时任务
crontab -e
每天凌晨n点运行脚本
0 n * * * root/script/docker_clean.sh
查看定时任务日志
tail -f /var/log/cron
列出目前的时程表
crontab -l