by bouleetbil
30. novembre 2011 22:07
I've installed a new server for backup websites/mysql/postfix...
1. I can test this services with Frugalware current before update the stable server.
2. And if one day I crash dors I can use this server as well. I should only change the dns and all work.
For backup the website I've use rsync with ssh it's very simple :
$ rsync -avz -e ssh MyLogin@StableServer:/mnt/sites /mnt/
For mysql I use mysqldump :
$ ssh MyLogin@StableServer 'mysqldump -u TheLogin -pThePassword --opt wikidb > '/mnt/backup/sql/wikidb.sql'
and restore it:
$ mysql --user=TheLogin --password=ThePassword wikidb < /mnt/backup/sql/wikidb.sql
For FTP/postfix.. I've restore my configuration.
And I've create a little script for backup dors.
If you would use ssh with cron the more simple is to use keychain :
$ sudo pacman-g2 -Sy keychain
$ nano $HOME/.bash_profile
Append the following code:
### START-Keychain ###
# Let re-use ssh-agent and/or gpg-agent between logins
/usr/bin/keychain $HOME/.ssh/id_dsa
source $HOME/.keychain/$HOSTNAME-sh
### End-Keychain ###
into your cron script add this lines :
# Make sure you can log in to remote server without a password
source $HOME/.keychain/$HOSTNAME-sh