The Answer to Life, the Universe, and Everything

Showing posts with label shell script. Show all posts
Showing posts with label shell script. Show all posts

Monday, December 18, 2006

Delete old files

remove.sh
#!/bin/bash
FILE=/xxx/xxx
find ${FILE} -ctime +5 -type f -exec rm -f {} \;


Change the permission.
# chmod +x remove.sh
# crontab -e


Register it as cron job.
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
1 20 * * * root /root/remove.sh


Done.