SupermanInNY
Verified User
- Joined
- Sep 28, 2004
- Messages
- 428
Hi All,
I have a simply script that removes old backups.
For whatever reason,I can't get the script to run properly and I don't know what I'm missing:
find /backup/weekly/* -daystart -type d -ctime +5 -maxdepth 0 | xargs rm -rf
I modified the name of the current backup so that I won't loose it. (from 09-21-08 to 09-21a-08).
I created a test directory called 09-14-08 and touched 3 files:
touch test1.tar.gz
touch test2.tar.gz
touch test3.tar.gz
So, running the script now, should delete this directory and it's content.
host.server.com:/backup/weekly # ll
total 8
drwxr-xr-x 2 root root 4096 Sep 21 14:06 09-14-08
drw-r----- 6 root root 4096 Sep 21 04:18 09-21a-08
host.server.com:/backup/weekly # find /backup/weekly/* -daystart -type d -ctime +1
host.server.com:/backup/weekly # find /backup/weekly/* -daystart -type d -ctime -1
/backup/weekly/09-14-08
/backup/weekly/09-21a-08
/backup/weekly/09-21a-08/mysql
/backup/weekly/09-21a-08/apache
/backup/weekly/09-21a-08/custom
/backup/weekly/09-21a-08/custom/etc
/backup/weekly/09-21a-08/custom/etc/ssh
/backup/weekly/09-21a-08/custom/etc/httpd
/backup/weekly/09-21a-08/custom/etc/httpd/conf
/backup/weekly/09-21a-08/custom/var
/backup/weekly/09-21a-08/custom/var/spool
/backup/weekly/09-21a-08/custom/usr
/backup/weekly/09-21a-08/custom/usr/lib
/backup/weekly/09-21a-08/custom/usr/share
/backup/weekly/09-21a-08/custom/usr/local
/backup/weekly/09-21a-08/custom/usr/local/directadmin
/backup/weekly/09-21a-08/custom/usr/local/directadmin/conf
/backup/weekly/09-21a-08/custom/home
/backup/weekly/09-21a-08/bind
host.server.com:/backup/weekly # find /backup/weekly/* -daystart -type d -ctime +5 -maxdepth 0 | xargs rm -rf
host.server.com:/backup/weekly # ll
total 8
drwxr-xr-x 2 root root 4096 Sep 21 14:06 09-14-08
drw-r----- 6 root root 4096 Sep 21 04:18 09-21a-08
host.server.com:/backup/weekly #
What am I missing??
Thanks for any pointers.
-Alon.
I have a simply script that removes old backups.
For whatever reason,I can't get the script to run properly and I don't know what I'm missing:
find /backup/weekly/* -daystart -type d -ctime +5 -maxdepth 0 | xargs rm -rf
I modified the name of the current backup so that I won't loose it. (from 09-21-08 to 09-21a-08).
I created a test directory called 09-14-08 and touched 3 files:
touch test1.tar.gz
touch test2.tar.gz
touch test3.tar.gz
So, running the script now, should delete this directory and it's content.
host.server.com:/backup/weekly # ll
total 8
drwxr-xr-x 2 root root 4096 Sep 21 14:06 09-14-08
drw-r----- 6 root root 4096 Sep 21 04:18 09-21a-08
host.server.com:/backup/weekly # find /backup/weekly/* -daystart -type d -ctime +1
host.server.com:/backup/weekly # find /backup/weekly/* -daystart -type d -ctime -1
/backup/weekly/09-14-08
/backup/weekly/09-21a-08
/backup/weekly/09-21a-08/mysql
/backup/weekly/09-21a-08/apache
/backup/weekly/09-21a-08/custom
/backup/weekly/09-21a-08/custom/etc
/backup/weekly/09-21a-08/custom/etc/ssh
/backup/weekly/09-21a-08/custom/etc/httpd
/backup/weekly/09-21a-08/custom/etc/httpd/conf
/backup/weekly/09-21a-08/custom/var
/backup/weekly/09-21a-08/custom/var/spool
/backup/weekly/09-21a-08/custom/usr
/backup/weekly/09-21a-08/custom/usr/lib
/backup/weekly/09-21a-08/custom/usr/share
/backup/weekly/09-21a-08/custom/usr/local
/backup/weekly/09-21a-08/custom/usr/local/directadmin
/backup/weekly/09-21a-08/custom/usr/local/directadmin/conf
/backup/weekly/09-21a-08/custom/home
/backup/weekly/09-21a-08/bind
host.server.com:/backup/weekly # find /backup/weekly/* -daystart -type d -ctime +5 -maxdepth 0 | xargs rm -rf
host.server.com:/backup/weekly # ll
total 8
drwxr-xr-x 2 root root 4096 Sep 21 14:06 09-14-08
drw-r----- 6 root root 4096 Sep 21 04:18 09-21a-08
host.server.com:/backup/weekly #
What am I missing??
Thanks for any pointers.
-Alon.