如题所述
1、vi /home/t.sh
#!/bin/bash
dst_dir=/abc
if [ -e a.txt ];then
find $dst_dir -type f -mtime +1 -exec rm -rf {} \;
fi
exit 0;
2、在/etc/bashrc增加
export EDITOR=vi
3、重新登录
crontab -e增加
0 12 * * * /home/t.sh;
:wq保存退出即可。
4、如果不需要文件判断,直接crontab -e 增加
0 12 * * * find /abc -type f -mtime +1 -exec rm -rf {} \;
#!/bin/bash
dst_dir=/abc
if [ -e a.txt ];then
find $dst_dir -type f -mtime +1 -exec rm -rf {} \;
fi
exit 0;
2、在/etc/bashrc增加
export EDITOR=vi
3、重新登录
crontab -e增加
0 12 * * * /home/t.sh;
:wq保存退出即可。
4、如果不需要文件判断,直接crontab -e 增加
0 12 * * * find /abc -type f -mtime +1 -exec rm -rf {} \;
温馨提示:答案为网友推荐,仅供参考