#! /bin/sh ### BEGIN INIT INFO # Provides: unipoly-mlmmj-ldap-sync # Required-Start: $remote_fs # Required-Stop: $remote_fs # Should-Start: $syslog # Default-Start: 2 3 4 5 # Default-Stop: 1 # Short-Description: daemon to push ldap changes to mlmmj for Unipoly ### END INIT INFO # Author: Axel Angel for GNU Generation and Unipoly APPDIR=/var/spool/exim4 PATH=/var/spool/exim4/bin:/sbin:/usr/sbin:/bin:/usr/bin DESC="Unipoly mlmmj ldap sync" NAME=unipoly-mlsync EXE=$APPDIR/bin/mlmmj-unipoly-ldap-listen EXESRV=$APPDIR/bin/mlmmj-unipoly-ldap-listen.pl DAEMON=$APPDIR/bin/mlmmj-unipoly-ldap-listen DAEMON_UID=Debian-exim DAEMON_GID=Debian-exim PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME # Exit if the package is not installed [ -x $DAEMON ] || exit 0 # Load the VERBOSE setting and other rcS variables . /lib/init/vars.sh # Define LSB log_* functions. . /lib/lsb/init-functions # Read configuration variable file if it is present [ -r /etc/default/$NAME ] && . /etc/default/$NAME # # Function that starts the daemon/service # do_start() { start-stop-daemon --start --quiet --exec $EXE \ --umask 0027 --chuid $DAEMON_UID:$DAEMON_GID \ --chdir "$APPDIR" --background -- \ || return 1 } # # Function that stops the daemon/service # do_stop() { pkill -u "$DAEMON_UID" -f "$APPDIR/bin/mlmmj-unipoly-ldap-listen.pl" } case "$1" in start) do_start case "$?" in 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; esac ;; stop) do_stop case "$?" in 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; esac ;; status) status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? ;; restart|force-reload) log_daemon_msg "Restarting $DESC" "$NAME" do_stop case "$?" in 0|1) do_start case "$?" in 0) log_end_msg 0 ;; 1) log_end_msg 1 ;; # Old process is still running *) log_end_msg 1 ;; # Failed to start esac ;; *) # Failed to stop log_end_msg 1 ;; esac ;; *) echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 exit 3 ;; esac :