Koozali.org: home of the SME Server

cron

Offline edb

  • *
  • 548
  • +0/-0
cron
« on: April 15, 2005, 09:30:15 PM »
I want to enable a scheduled rsync session to backup my files to another server every day at midnight.

I created a script called /root/backup.sh which I tested from the command line and it works great.
The file contains these commands:
#!/bin/sh

rsync -R -av /home/* 192.168.225.50::servername/server11
rsync -R -av /etc/* 192.168.225.50::servername/server11
rsync -R -av /opt/* 192.168.225.50::servername/server11
rsync -R -av /plus/* 192.168.225.50::servername/server11
rsync -R -av /root/* 192.168.225.50::servername/server11
rsync -R -av /usr/* 192.168.225.50::servername/server11
rsync -R -av /bin/* 192.168.225.50::servername/server11
rsync -R -av /sbin/* 192.168.225.50::servername/server11
rsync -R -av /var/* 192.168.225.50::servername/server11
rsync -R -av /lib/* 192.168.225.50::servername/server11
rsync -R -av /boot/* 192.168.225.50::servername/server11
rsync -R -av /command/* 192.168.225.50::servername/server11
rsync -R -av /service/* 192.168.225.50::servername/server11
rsync -R -av /aquota.group 192.168.225.50::servername/server11
rsync -R -av /aquota.user 192.168.225.50::servername/server11

I added an entry in /etc/e-smith/templates-custom/etc/crontab/rsync with the following contents:

# Daily System Backup Script
0 0 * * * root /root/backup.sh

I expanded the template and restarted cron but it won't work. Any ideas?

Thanks

Ed
......

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: cron
« Reply #1 on: April 15, 2005, 10:32:07 PM »
Quote from: "edb"

The file contains these commands:
#!/bin/sh

rsync -R -av /home/* 192.168.225.50::servername/server11
rsync -R -av /etc/* 192.168.225.50::servername/server11
...


You're writing to an anonymous drop area. Anyone else on your LAN could do that as well, presumably. Very insecure - you're backups couldn't be relied upon.

Instead, use "rsync -e ssh" and set up public key based ssh authentication.

Quote

...
rsync -R -av /usr/* 192.168.225.50::servername/server11
rsync -R -av /bin/* 192.168.225.50::servername/server11
rsync -R -av /sbin/* 192.168.225.50::servername/server11
...


Those directories should only contain stuff installed from CDROM, or from RPMs. You don't need to back it up, since you'll be restoring to a fresh install.

Quote

# Daily System Backup Script
0 0 * * * root /root/backup.sh

I expanded the template and restarted cron but it won't work. Any ideas?


The expanded template probably doesn't have execute permission set. Try "sh /root/backup.sh" in your cron fragment.

Offline edb

  • *
  • 548
  • +0/-0
cron
« Reply #2 on: April 15, 2005, 11:20:05 PM »
Thanks Charlie
......