1.编写shell脚本,我这里写的是clean-images.sh

2.crontab -e编辑定时任务。

linux新加定时任务

然后用vi编辑器,输入0 */2 * * * /data/docker/script/clean-images.sh >> /data/docker/script/clean-images.log

最后wq!保存。

3,重启crontab

service crond restart

相关文章: