- 写一个shell.
#!/bin/bash
direc="/opt/tmp/aaa/a"
for dir2del in $direc/* ; do
if [ -f "$dir2del" ]; then
rm -rf $dir2del
fi
done
2.给这个文件加权限:
chmod +x filename.sh
- crontab 执行任务调度
crontab -e
4.每五分钟执行
*/5 * * * * /bin/sh /home//del.sh
5.重启。
service crond restart
参考资料:
(http://www.cnblogs.com/cute/archive/2012/05/11/2496213.html)
(http://zhangzhaoaaa.iteye.com/blog/1991245)