One-Click Backups
There are fast and automated ways of backing up *NIX servers. Backups should include databases as well as home directories, of which there can be many.
Compressed Archives
If backups can be downloaded via links (e.g. under cPanel), a browser can have its default action for .gz files set to “save in home directory”. A little script can then timestamp all the archives and put them ‘in storage’:
# Once back-ups have been put in home directory, move all
# to a time-stamped directory in the back-up area
cd /home/user/
mkdir `date +%Y-%m-%d`
mv backup* /home/user/backup/Home_Directories
# move home directories
mv *.gz `date +%Y-%m-%d`
# move databases to the new directory
cp -rf `date +%Y-%m-%d` /home/user/backup/Databases/Recent
# merge if required
rm -r `date +%Y-%m-%d`
# clean up, NOTE: mv cannot merge
FTP
If your webspace host offers FTP access alone, there is no simple solution. Command-line ftp might be of use though.
SCP
Copy files from the server to your local machine. This step must be invoked from the server’s side. The form of the command resembles the following:
scp -r ~/public_html your_user_name@machine.domain.suffix:/home/user/backup
mySQL Dumps
Set up cron jobs on the server, e.g.:
0 23 * * 1,4 mysqldump --user [DB_username] --password=[DB_password] [DB_name]> ~/tmp/mydatabase1.dump
0 23 * * 2,5 mysqldump --user [DB_username] --password=[DB_password] [DB_name]> ~/tmp/mydatabase2.dump
0 23 * * 0,3,6 mysqldump --user [DB_username] --password=[DB_password] [DB_name]> ~/tmp/mydatabase3.dump
The code above keeps a stack of 3 databases, which can be used to rollback data shall something catastrophic happen. Databases can then be snatched along with home directories. The above code can be extended so that dumps are compressed and file destinations are remote.






Filed under:
Where there’s smoke, there must be a fire. The streets of Manchester are full of smoke at the moment so there must be a large-scale wildfire. There was no evidence of a fire while I was walking home for breakfast; only half an hour later (now), the streets are foggy with smoke.
his entry does not concern spam, but rather the management of mail which belongs to a different ‘classes’, e.g. academia, work and play. It is a simple efficiency tip.
have become absolutely fed up with travel. Travelling seems rather analogous to brocoli. Even though it offers benefits, it is fairly hard to digest. Having come back from Oxford 2 days ago, I asked myself:

