3

Simple Script to backup dir and Mysql db

view full story
linux-howto

http://forums.opensuse.org – Hi all, I have a simple script, which for sure i need to enhance more and more. For now, it is just making a compress file in tar.gz format in output dir. Here is script: Quote: #!/bin/bash #Defines output file OUTPUT=/Documents/backup_$(date +%Y%m%d%H%M%S).tar.gz #Defines directory to backup INPUTDIR="/Documents/Assignments" #Display message about starting the backup echo "Starting backup of directory $INPUTDIR to file $OUTPUT" #Start the backup tar -czf $OUTPUT $INPUTDIR #Checking the status of the last process: if [ $? == 0 ]; then #Display confirmation message echo "The file: "$OUTPUT echo "was created as a backup for: "$INPUTDIR else #Display error message message echo "There was a problem creating: "$OUTPUT echo "as a backup for: "$INPUTDIR fi But whenever i run it in terminal, it make the backup file but also throw this error in terminal, it also compress the Documents dir inside it. Which i don't want. Quote: Starting backup of directory /Documents/Assignments to file /Documents/backup_20091201141406.tar.gz tar: Removing leading `/' from member names [: 24: 0: unexpected operator There was a problem creating: /Documents/backup_20091201141406.tar.gz as a backup for: /Documents/Assignments Also i want to know a bit about the leading '/' from member names. Any ideas to enhance and add MySQL database code to it would be greatly appreciated. Thanks (Distributions)