[Csync2] csync2 init.d script
Michael Mansour
mic at npgx.com.au
Sat Dec 1 01:43:38 CET 2007
Hi Marcus,
> I know someone asked on here about an init.d script for csync2. I
> was looking for one too after inetd was not working for me. I found
> one from pld-linux here:
>
> http://cvs.pld-linux.org/cgi-
> bin/cvsweb.cgi/SOURCES/csync2.init?rev=1.2;content-type=text%2Fplain
I'm confused as to why this script is needed?
I've been running csync2 for many years and have only ever used it by cron'ing
the "csync2 -x blah".
What does this script provide that a cron doesn't?
Thanks for the info also.
Michael.
> However, it uses some rc.d scripts that are apparently only present
> in RedHat, Mandrake and a few other distros, and doesn't work in
> Debian/ Ubuntu. I found a shell init.d script and built one that
> seems to work:
>
> #!/bin/sh
> #
> # csync2: Init script for csync2 synchronisation daemon
> #
> # chkconfig: 345 90 10
> # description: csync2 is a mechanism for keeping multiple servers in
> sync.
> # pidfile: /var/run/csync2.pid
> #
> # by Marcus Bointon <marcus at synchromedia.co.uk>
> # adapted from http://osdir.com/ml/mail.postfix.sqlgrey/2006-07/msg00000.html
> by Karl O. Pinc
> # GPL license
>
> CSYNC2=/usr/sbin/csync2
>
> # See how we were called.
> case "$1" in
> start)
> echo -n " csync2"
> ERRMSG=$(/sbin/start-stop-daemon --pidfile /var/run/
> csync2.pid --make-pidfile --background --exec $CSYNC2 --start -- -ii
> 2>&1)
>
> if [ $? != 0 ]; then
> echo "(FAILED)"
> [ "$ERRMSG" ] && echo "ERROR: $ERRMSG" >&2 || true
> exit 1
> fi
>
> [ "$ERRMSG" ] && echo -n " ($ERRMSG)" >&2 || true
> ;;
>
> stop)
> echo -n " csync2"
> start-stop-daemon --stop --pidfile /var/run/csync2.pid
> rm -f /var/run/csync2.pid
> ;;
>
> restart)
> $0 stop
> sleep 1
> $0 start
> ;;
>
> *)
> echo "Usage: csync2 {start|stop|restart}"
> exit 1
> esac
>
> exit 0
>
> In particular it seems that you do need to explicitly tell csync2 to
> detach and to create a pid file.
>
> Hope it's of use to others, the archives, or anyone who cares to
> improve it (the PLD Linux one is quite a lot better).
>
> Marcus
> --
> Marcus Bointon
> Synchromedia Limited: Creators of http://www.smartmessages.net/
> UK resellers of info at hand CRM solutions
> marcus at synchromedia.co.uk | http://www.synchromedia.co.uk/
------- End of Original Message -------
More information about the Csync2
mailing list