BreadCrumbs: Server Backup

Server Backup

From Luke Jackson

(Difference between revisions)
Jump to: navigation, search
Revision as of 15:42, 3 July 2007 (edit)
Ljackson (Talk | contribs)
(Linux)
← Previous diff
Current revision (01:15, 26 August 2012) (edit)
Ljackson (Talk | contribs)
(Windows)
 
Line 1: Line 1:
 += Mac OSX =
 +
 + tar zcvf h9mj4guj.default.tar.gz /Users/ljackson/Library/Application\ Support/Firefox/Profiles/h9mj4guj.default/
 + tar zcvf 7xfyev89.default.tar.gz /Users/ljackson/Library/Thunderbird/Profiles/7xfyev89.default/
 +
= Windows = = Windows =
Line 7: Line 12:
Simply copy one of the scripts below into a file in the '''/etc/cron.weekly''' directory. Simply copy one of the scripts below into a file in the '''/etc/cron.weekly''' directory.
-== Scripts ==+== Named (Bind), Apache, MySQL, Postfix, WWW Data ==
- +
-Various backup scripts for different configurations.+
- +
-=== Named (Bind), Apache, MySQL, Postfix, WWW Data ===+
Below is a simple backup script which saves the configuration files for the following applications: Below is a simple backup script which saves the configuration files for the following applications:
Line 20: Line 21:
* Postfix * Postfix
-'''Note:''' It is assumed that the default install paths have been used and all web contend has a base of '''/www'''+'''Note:''' It is assumed that the default install paths have been used and all web contend has a base of '''/www'''.
-== Shell Script ==+=== Shell Script ===
<pre> <pre>
Line 28: Line 29:
TODAY=`date +%m_%d_%Y` TODAY=`date +%m_%d_%Y`
-SERVER=domain.ext+SERVER=`hostname`
cd /home/juser/backups/ cd /home/juser/backups/
Line 58: Line 59:
</pre> </pre>
 +== Asterisk, MySQL, FreePBX ==
 +
 +Below is a simple backup script which saves the configuration files for the following applications:
 +
 +* Asterisk
 +* MySQL
 +* FreePBX
 +
 +'''Note:''' It is assumed that the default install paths have been used.
 +
 +=== Shell Script ===
 +
 +<pre>
 +! /bin/sh
 +
 +TODAY=`date +%m_%d_%Y`
 +SERVER=asterisk.us.root.prv
 +
 +mkdir /root/backups
 +cd /root/backups/
 +
 +### Backup Asterisk Config ###
 +tar zcvf $SERVER.config.tar.gz /etc/asterisk/ >>/dev/null
 +
 +echo "Completed Asterisk Config Backup on $SERVER for $TODAY......"
 +
 +#### Backup Sounds ####
 +tar zcvf $SERVER.sounds.tar.gz /var/lib/asterisk/ >>/dev/null
 +
 +echo "Completed Sounds Backup on $SERVER for $TODAY......"
 +
 +#### Backup Modules ####
 +tar zcvf $SERVER.modules.tar.gz /usr/lib/asterisk/ >>/dev/null
 +
 +echo "Completed Modules Backup on $SERVER for $TODAY......"
 +
 +### Backup MySQL Server ###
 +mysqldump --user=root --password=passw0rd --all-databases | gzip -c > $SERVER.sql.gz
 +
 +echo "Completed MySQL Server Backup on $SERVER for $TODAY......"
 +
 +### Backup Logs ###
 +tar zcvf $SERVER.logs.tar.gz /var/log/asterisk/ >>/dev/null
 +
 +echo "Completed Logs Backup on $SERVER for $TODAY....."
 +
 +## Backup Voicemail ##
 +tar zcvf $SERVER.voicemail.tar.gz /var/spool/asterisk/ >>/dev/null
 +
 +echo "Completed Voicemail Backup on $SERVER for $TODAY....."
 +
 +## Backup FreePBX ##
 +tar zcvf $SERVER.freepbx.tar.gz /usr/src/ >>/dev/null
 +
 +echo "Completed FreePBX Backup on $SERVER for $TODAY....."
 +
 +## Backup HTML ##
 +tar zcvf $SERVER.html.tar.gz /var/www/html/ >>/dev/null
 +
 +echo "Completed HTML Backup on $SERVER for $TODAY....."
 +</pre>
 +
 +[[Category:VoIP]]
[[Category:Linux]] [[Category:Linux]]
[[Category:Mac OS X]] [[Category:Mac OS X]]

Current revision

Contents

Mac OSX

tar zcvf h9mj4guj.default.tar.gz /Users/ljackson/Library/Application\ Support/Firefox/Profiles/h9mj4guj.default/
tar zcvf 7xfyev89.default.tar.gz /Users/ljackson/Library/Thunderbird/Profiles/7xfyev89.default/

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=`hostname`

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....."

Asterisk, MySQL, FreePBX

Below is a simple backup script which saves the configuration files for the following applications:

  • Asterisk
  • MySQL
  • FreePBX

Note: It is assumed that the default install paths have been used.

Shell Script

! /bin/sh

TODAY=`date +%m_%d_%Y`
SERVER=asterisk.us.root.prv

mkdir /root/backups
cd /root/backups/

### Backup Asterisk Config  ###
tar zcvf $SERVER.config.tar.gz /etc/asterisk/ >>/dev/null

echo "Completed Asterisk Config Backup on $SERVER for $TODAY......"

#### Backup Sounds ####
tar zcvf $SERVER.sounds.tar.gz /var/lib/asterisk/ >>/dev/null

echo "Completed Sounds Backup on $SERVER for $TODAY......"

#### Backup Modules ####
tar zcvf $SERVER.modules.tar.gz /usr/lib/asterisk/ >>/dev/null

echo "Completed Modules Backup on $SERVER for $TODAY......"

### Backup MySQL Server ###
mysqldump --user=root --password=passw0rd --all-databases | gzip -c > $SERVER.sql.gz

echo "Completed MySQL Server Backup on $SERVER for $TODAY......"

### Backup Logs ###
tar zcvf $SERVER.logs.tar.gz /var/log/asterisk/ >>/dev/null

echo "Completed Logs Backup on $SERVER for $TODAY....."

## Backup Voicemail ##
tar zcvf $SERVER.voicemail.tar.gz /var/spool/asterisk/ >>/dev/null

echo "Completed Voicemail Backup on $SERVER for $TODAY....."

## Backup FreePBX ##
tar zcvf $SERVER.freepbx.tar.gz /usr/src/ >>/dev/null

echo "Completed FreePBX Backup on $SERVER for $TODAY....."

## Backup HTML ##
tar zcvf $SERVER.html.tar.gz /var/www/html/ >>/dev/null

echo "Completed HTML Backup on $SERVER for $TODAY....."
Personal tools