July 13, 2005 04:31 | Technology / WebBlogging / WebTech

Remote backup script...

I've got an idea for a shell script/program that would be very useful to me, and probably countless others. In fact I bet countless others have already coded something like it up...

Requirements:
I don't care what programming language it's written in as long as I can run it more or less easily from the terminal or cron. Keep in mind it's gonna be doing a lot of network and system level stuff. Shell(?), Perl or Python are probably the top contenders.

Tasks:

  1. Take as input a list of server addresses, username and passwords and paths to directories to be processed, as well as local destination paths. May be multiple paths for individual servers. List can be within the first part of the script or in a separate config file.
  2. SSH to each server, cd to the directory above the one we want to backup, tar-gz it using a dated naming convention (something like SERVERNAME-DIRNAME-YYYY-MM-DD-HH-MI.tgz).
  3. Download the archive to the specified local path.
  4. Delete the archive from the server.
  5. rinse, repeat, exit.

Ideally, I'd also like to do remote SQL database backups this way... SSH in, take a (MySQL) dump, targz the file, pull it down, clean up, exit.

Who is game to hack this up for me, and for how much? Perhaps we could set up a pool on fundable for it.

Maybe I should Learn Perl the Hard Way myself... ;)

Comments

:) on prend un verre ;)


Ask and ye shall receive:

http://www.nongnu.org/rdiff-backup/

I've been using it for a few years and do not have a single complaint.


Thank you Mina. Forgot about rdiff. I wasn't in the regular "back up my stuff" frame of mind when I wrote this. I imagine rdiff can be configured to do what I want... :)

Ouais, Karl, moment donné, un de ces jours... ;)