Setup rsync server
For example, we want to set up an rsync server to duplicate the subversion server data to other computers.
First, of cause we have to have rsync installed. For fedora, this should be included in default installation.
Then we will create the config folder and config in Fedora’s style:
cd /etc mkdir rsyncd cd rsyncd touch rsyncd.conf touch rsyncd.motd touch rsyncd.secrets chmod 600 rsyncd.secrets
Then will edit rsyncd.conf file:
pid file=/var/run/rsyncd.pid port=873 address=192.168.2.111 uid=root gid=root use chroot=yes read only=yes # limit access to LANS hosts allow=192.168.2.0/255.255.255.0 host deny=* max connections=5 motd file=/etc/rsyncd/rsyncd.motd log format=%t%a%m%f%b syslog facility=local3 timeout=300 [svn] path=/var/www/svn list=yes ignore errors auth users=svnsyncer secrets file=/etc/rsyncd/rsyncd.secrets comment=SVN Repository
We will add the welcome message to /etc/rsyncd/rsyncd.motd
Welcome the SVN rsync service
Add user/password to /etc/rsyncd/rsyncd.secrets
svnsyncer:123456
And then, we will create our init start up script named /etc/init.d/rsyncd
#!/bin/sh
#
# Startup script for rsyncd daemon
#
# chkconfig: 35 90 10
# description: Server data for sync to other server
# processname rsync
# Source function library
. /etc/rc.d/init.d/functions
prog=rsync
conf=/etc/rsyncd/rsyncd.conf
case "$1" in
start)
echo -n "Starting rsync daemon: "
daemon /usr/bin/$prog --daemon --config=$conf
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/$prog
;;
stop)
echo -n "Shutting down $prog: "
killproc -d 60 $prog
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/$prog
;;
status)
status $prog
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit 0
We will register and this service by
/sbin/chkconfig --add rsyncd /sbin/service rsyncd start
August 8th, 2008 at 12:51 pm
“Then will edit syncd.conf file:”
Should it be rsyncd.conf instead?
August 17th, 2008 at 12:52 am
Yes, it is. Thank you for pointing it out.