Crond script doesn't work as expected
Hi everybody!
I'm posting here because, having a long time surfing the internet I still don't have a solution to my issue. The script does a backup of a specific directory once a day, deleting the oldest backups if they are more than 31. The script run perfectly executed from console, but under crond it create correctly the backup but not seems to delete the in-excess backups. Code:
#!/bin/bash I really don't understand the reason. Thank you for helping me, Karimo |
Why use "/root" for backups? And why add the date that way when you can use easier sorting with just
Code:
TARDATE=$(date +%Y%m%d); tar -cjf /backupmountpoint/condivisa_backups/polizze_${TARDATE}.tar.bz2 /mnt/hd/condivisa/GRUPPO\ POLIZZE >/dev/null 2>&1 Code:
find /backupmountpoint/condivisa_backups/ -type f -iname polizze_\* -atime +31 -print0|xargs -0 echo rm -f |
All times are GMT -5. The time now is 06:44 AM. |