想用shell实现定时任务

weixin_38309584 2017-05-08 11:42:56
想用shell实现定时任务:查找centos服务器中文件较大的txt文件,大于某某MB的就删除,并生成删除日志

有没有大神会的,给点提示也可以
...全文
502 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
weixin_38309584 2017-05-11
  • 打赏
  • 举报
回复
引用 5 楼 kairui123 的回复:
vim rm.sh find / -size +sizeMB > /tpm/rmfile for $name in then rm -rf $name if [ $? -eq 0 ] echo "at $(date) rm $name" fi done < /tpm/rmfile crontab -e */15 */24 * * * bash rm.sh 表示每天24:15执行一下此脚本 有bug你的调试一下
啊 谢谢谢谢 我研究下
Insane_linux 2017-05-08
  • 打赏
  • 举报
回复
vim rm.sh find / -size +sizeMB > /tpm/rmfile for $name in then rm -rf $name if [ $? -eq 0 ] echo "at $(date) rm $name" fi done < /tpm/rmfile crontab -e */15 */24 * * * bash rm.sh 表示每天24:15执行一下此脚本 有bug你的调试一下
weixin_38309584 2017-05-08
  • 打赏
  • 举报
回复
引用 3 楼 q3733353520 的回复:
[quote=引用 2 楼 weixin_38309584 的回复:] [quote=引用 1 楼 q3733353520 的回复:] 百度搜索 linux定时任务crontab
定时任务知道,主要对shell的了解不深[/quote] ok thanks
  • 打赏
  • 举报
回复
引用 2 楼 weixin_38309584 的回复:
[quote=引用 1 楼 q3733353520 的回复:] 百度搜索 linux定时任务crontab
定时任务知道,主要对shell的了解不深[/quote] stat -c %s filename 获取文件大小
weixin_38309584 2017-05-08
  • 打赏
  • 举报
回复
引用 1 楼 q3733353520 的回复:
百度搜索 linux定时任务crontab
定时任务知道,主要对shell的了解不深
  • 打赏
  • 举报
回复
百度搜索 linux定时任务crontab

19,610

社区成员

发帖
与我相关
我的任务
社区描述
系统使用、管理、维护问题。可以是Ubuntu, Fedora, Unix等等
社区管理员
  • 系统维护与使用区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧