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

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