BreadCrumbs: Server Backup
Server Backup
From Luke Jackson
Revision as of 15:40, 3 July 2007; Ljackson (Talk | contribs)
(diff) ←Older revision | Current revision | Newer revision→ (diff)
(diff) ←Older revision | Current revision | Newer revision→ (diff)
Contents |
Windows
Linux
Cron
Simply copy one of the scripts below into a file in the /etc/cron.weekly directory.
Named (Bind), Apache, MySQL, Postfix, WWW Data
Below is a simple backup script which saves the configuration files for the following applications:
- Named (Bind)
- Apache
- MySQL
- Postfix
Note: It is assumed that the default install paths have been used and all web contend has a base of /www
Shell Script
#! /bin/sh TODAY=`date +%m_%d_%Y` SERVER=domain.ext cd /home/juser/backups/ ### Backup Apache Config ### tar zcvf $SERVER.httpd.tar.gz /etc/httpd/ >>/dev/null echo "Completed Apache Config Backup on $SERVER for $TODAY......" #### Backup Named Config #### tar zcvf $SERVER.named.tar.gz /var/named/ >>/dev/null echo "Completed Named Config Backup on $SERVER for $TODAY......" #### Backup Postfix Config #### tar zcvf $SERVER.postfix.tar.gz /etc/postfix/ >>/dev/null echo "Completed Postfix Config Backup on $SERVER for $TODAY......" ### Backup MySQL Server ### mysqldump --user=mysqlbackup --password=backup --all-databases | gzip -c > $SERVER.sql.gz echo "Completed MySQL Server Backup on $SERVER for $TODAY......" ### Backup Data ### tar zcvf $SERVER.server.tar.gz /www/ >>/dev/null echo "Completed Data Backup on $SERVER for $TODAY....."