Wednesday, November 17, 2010

The simplest backup solution ever...

... not for everyone maybe, but for me as a linux/java/groovy person it is!

you'll need

  • java
  • groovy
  • rsync
  • ssh
  • cron

I want to regularly copy files from a bunch of paths from several remote hosts to the localhost. I know nothing about arrays etc in bash to configure this stuff in a simple way but the solution I've come up with is simple and elegant: 
I wrote a little groovy script that generates the shell commands to be executed. the output of the groovy script is piped into bash, which executes the commands. That call of the groovy script with the piping to the bash is in a little shell script which is called from cron.

Simple, right? Here's the code:


The output of the above script looks like this:

crontab (executes every morning at 0700)

And that's it already!!
Read this for some security hints regarding rsync over ssh:

No comments:

Post a Comment