PDA

View Full Version : tar and split not showing date



AsianGuyJTran
7th October 2007, 07:08 PM
hi all.

i have a cron job set for weekly backups of my server and they are starting to get to the point where i have to split them for single layer dvds

i found that i can use split to split them at 4gb
however, the files don't have the date in the filename

here is the command i use to start backups


tar -cvf - --exclude /home/jamiesEmb --exclude /home/backup /home /etc/httpd/conf /var/lib/mysql | split -a 2 -b 4608m - /home/backup/www_backup`date '+%Y%m%d'`.tar.gz

im getting the following files
www_backup.tar.gz.aa
www_backup.tar.gz.ab

instead of
www_backup20071007.tar.gz.aa
www_backup20071007.tar.gz.ab

any ideas?

stevea
7th October 2007, 07:33 PM
Is that in a script ? Any chance the PATH is changes and date isn't found ? Use /bin/date perhaps.

What does this return :
echo split -a 2 -b 4608m - /home/backup/www_backup`date '+%Y%m%d'`.tar.gz

AsianGuyJTran
8th October 2007, 01:30 AM
it is not in a script. i just execute it directly from cron

when i executed the line you gave me, i got
split -a 2 -b 4608m - /home/backup/www_backup20071007.tar.gz