首页 > 技术文章 > Linux 添加定时任务

iathanasy 2019-09-10 18:01 原文

# vim del-logs.sh
#
每天 凌晨6:30删除日志 # 查找7天以前的: find /root/mnt/iot/logs/spring.log.* -mtime +7 # 定时任务 添加:crontab -e 查看: crontab -l # 为当前脚本赋予权限 chmod +x del-logs.sh # 定时任务 每天6:30执行 crontab -e # 30 6 * * * /root/mnt/iot/del-logs.sh find /root/mnt/iot/logs/spring.log.* -mtime +35 -exec rm -rf {} \;

 

推荐阅读