Welcome to shellscript.co.uk a small resource on shell scripting.

Apologies, this site is still a work in progress.


Scripts

backup.sh

Back up your MSQL database & the /etc, /var/www directory's.

#!/bin/sh

MyDate='/bin/date +%Y-%m-%d'

MyLocation='/var/server_backup'
MyArchive='/var/server_archive'

/bin/mv "$MyLocation"/* "$MyArchive"
/bin/tar -czf "$MyLocation"/etc-`$MyDate`.tar.gz /etc
/bin/tar -czf "$MyLocation"/www-`$MyDate`.tar.gz /var/www
/usr/bin/mysqldump --opt --all-databases -u root -ppassword > "$MyLocation"/db-`$MyDate`.sql

The locations can be modified for what you need.



Quote: "If you don't want to be replaced by a computer, don't act like one." - Arno Penzias