backing up crontabs over ssh (many-to-one disk-to-disk backup)

Submitted by Aleksey Tsalolikhin on Wed, 2008-03-05 22:02.

Here is a pair of ssh "for" loops to backup all the crontabs on my Linux and HP-UX systems to my admin host:

for f in `cat ~/linux_hostnames.txt `
do
echo backing up $f; ssh $f 'sudo tar cvf - /var/spool/cron/' > $f.tar
done

for f in `cat ~/hpux_hostnames.txt `
do
echo backing up $f; ssh $f 'sudo tar cvf - /var/spool/cron/crontabs' > $f.tar
done

Let me know if this is useful to you.

Best,
Aleksey

Trackback URL for this post:

http://lopsa.org/trackback/1591