some script-question: date as filename
i would like to have a script for making a backup of my data on a webserver...
i thought of first savin the database to some *sql and then zipping all files... ...this is no problem, but it would be usefull, if i could rename the files in the way that the date is patr of filename... but how to involve the date into filename?! the so-far-script: Code:
mysqldump -uusername -p database > ~/www/db.sql |
you'd use backticks in the zip command
zip -R -9 -o ~/bak/backup-`date +%m-%d-%Y` ~/www/* seems to make sense. you would have been able to jsut say date +%D but the standard date output contains /'s which is no use in a filename now is it? good golly no. |
DATESTRING=`date +"%Y%m%d"`
One must be very quick here. Acid_kewpie posted a complete answer while I was pulling together some information to post my short one. But I have a question: does zip store permissions in the archive? Not so long ago I throwed away zip and rather used tar + gzip for this purpose because zip did not seem to store the permission information with the archived files. |
Thank you guys, also for your swiftness... This'll help me!
|
All times are GMT -5. The time now is 12:32 PM. |