rsync howto: source-host data destination-host rsync daemon |--> rsyncs the source tcp 873 source-host: =========== a) /etc/rsyncd.conf # file: rsyncd.conf # uid = root gid = root pid file = /var/run/rsyncd.pid [root] path = / comment = root exclude = /proc /mnt [home] path = /home exclude = /home/publicftp # eof /etc/rsyncd.conf b) /etc/initd.d/rsyncd #!/bin/sh # # chkconfig: - 90 90 # description: rsync daemon to backup this mashine # # skeleton example file to build /etc/init.d/ scripts. # This file should be used to construct scripts for /etc/init.d. # # Written by Miquel van Smoorenburg . # Modified for Debian GNU/Linux # by Ian Murdock . # # Version: @(#)skeleton 1.9.1 08-Apr-2002 miquels@cistron.nl # file: rsyncd # # Source function library. . /etc/init.d/functions PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/bin/rsync NAME=rsync DESC="rsync" DAEMON=/usr/bin/rsync test -x $DAEMON || exit 0 case "$1" in start) echo -n "Starting $DESC: $NAME" $DAEMON --config=/etc/rsyncd.conf --daemon -z touch /var/run/$NAME.pid echo "." ;; stop) echo -n "Stopping $DESC: $NAME " kilall rsync echo "." ;; restart) $0 stop sleep 1 $0 start ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|restart}" >&2 exit 1 ;; esac exit 0 # eof /etc/initd.d/rsyncd c) optional: add a firewall rule IPofDestHost="1.2.3.4" iptables -A INPUT -i $INET_IFACE -s ${IPofDestHost} -p tcp --dport 873 -j ACCEPT destinaton-host: =============== a) executes rsync #!/bin/sh # # file: rsyncScript.sh # IPofSourceHost="1.2.3.4" /usr/bin/rsync -az --delete-after --ignore-errors ${IPofSourceHost}::root /targetDirectory/ # eof rsyncScript.sh b) add to roots cron tab # backs up source mashine every night 2 o'clock 0 2 * * * nohup /PathOfScript/rsyncScript.sh >/dev/null 2>&1 & # eof