linux下创建crontab定时清理服务任务

1.编写定时任务脚本

#!/bin/bash
 for i in `find . -type f -name *.log -size +800M`
 do
     echo $i
     cat /dev/null > $i
 done

2.生成新的crontab定时任务

crontab -e    

之后在打开的文件里添加每分钟定时清理脚本,配置更新后会自动识别
* * * * * sh xx.sh

3.查看系统现有的crontab命令

crontab -l 

 知识点:https://linuxtools-rst.readthedocs.io/zh_CN/latest/tool/crontab.html

猜你喜欢

转载自blog.csdn.net/muyimo/article/details/103513935
今日推荐