SSH protocol and the scp command are rather powerful and secure. With one swift scp command the entire web server directory, or directories, can be backed up. I have in the past copied my raw mysql database files for purposes of backup, then to restore them later just by copying them to the proper location. Fedora Core 7, and Fedora 7 stores its mysql database files in:
/var/lib/mysql
Therefore to backup the entire /var/lib/mysql directory use:
scp-r /var/lib/mysql/* user@othercomputerip:webserverbackupfolder/
The same command can be used for your root website folders.
This simply command is great for webmasters that update their websites often. It allows for cron (automated) jobs to be run taking care of critical backup procedures.
Since SSH and scp rely on rsa encryption protocols, you must use the ssh-keygen command to generate your keys. If you plan to use to above scp command to automatically backup your files, your rsa key will have to use no password. The ssh-keygen command prompts you for a password or none.
Once you generate your scp scripts you can pop them in your /etc/cron.hourly or /etc/cron.daily folders to achieve automation.
All the scp script will contain is two scp command with appropriate options. An example:
scp -r /var/lib/mysql/* user@othercomputerip:mysqlbackup/
scp -r /home/user/websites/* user@othercomputerip:mysqlbackup/
You can plate the above two line, after customization, in a file called autossh.sh
Then make the file executable, and you can run it by:
./autossh.sh
Share, Enjoy, and Support: