Formatting code for LinuxRsync
{{Parent page="Linux"}}
===Rsync===
Also take a look at [[http://www.cis.upenn.edu/~bcpierce/unison Unison]], a bi-direction sync tool based on rsync
Sample command:
%%
# this synchronize www.blah.com across two servers. deletes are also replicated.
unison /home/sites ssh://1.2.3.4//home/sites -path www.blah.com -batch
%%
==Start rsync as a standalone daemon==
%%
#!/bin/sh
# Rsyncd This shell script takes care of starting and stopping the rsync daemon
# description: Rsync is an awesome replication tool.
# Source function library.
. /etc/rc.d/init.d/functions
[ -f /usr/bin/rsync ] || exit 0
case "$1" in
start)
action "Starting rsyncd: " /usr/bin/rsync --daemon
;;
stop)
action "Stopping rsyncd: " killall rsync
;;
*)
echo "Usage: rsyncd {start|stop}"
exit 1
esac
exit 0
%%
==Sample rsyncd.conf==
%%
#/etc/rsyncd.conf
secrets file = /etc/rsyncd.secrets
motd file = /etc/rsyncd.motd #Below are actually defaults, but to be on the safe side...
read only = yes
list = yes
uid = nobody
gid = nobody
[out]
comment = Great stuff from remote.acme.com
path = /home/rsync/out
[confidential]
comment = For your eyes only
path = /home/rsync/secret-out
auth users = joe,jane
hosts allow = *.acme.com
hosts deny = *
list = false
%%
===Rsync===
Also take a look at [[http://www.cis.upenn.edu/~bcpierce/unison Unison]], a bi-direction sync tool based on rsync
Sample command:
%%
# this synchronize www.blah.com across two servers. deletes are also replicated.
unison /home/sites ssh://1.2.3.4//home/sites -path www.blah.com -batch
%%
==Start rsync as a standalone daemon==
%%
#!/bin/sh
# Rsyncd This shell script takes care of starting and stopping the rsync daemon
# description: Rsync is an awesome replication tool.
# Source function library.
. /etc/rc.d/init.d/functions
[ -f /usr/bin/rsync ] || exit 0
case "$1" in
start)
action "Starting rsyncd: " /usr/bin/rsync --daemon
;;
stop)
action "Stopping rsyncd: " killall rsync
;;
*)
echo "Usage: rsyncd {start|stop}"
exit 1
esac
exit 0
%%
==Sample rsyncd.conf==
%%
#/etc/rsyncd.conf
secrets file = /etc/rsyncd.secrets
motd file = /etc/rsyncd.motd #Below are actually defaults, but to be on the safe side...
read only = yes
list = yes
uid = nobody
gid = nobody
[out]
comment = Great stuff from remote.acme.com
path = /home/rsync/out
[confidential]
comment = For your eyes only
path = /home/rsync/secret-out
auth users = joe,jane
hosts allow = *.acme.com
hosts deny = *
list = false
%%