#! /bin/sh # # pserv This starts and stops the POPular pserv. # # chkconfig: 345 92 08 # description: pserv is part of the POPular mailbox storage server \ # suite. # # processname: /usr/sbin/pserv # config: /etc/popular/pserv.rc # pidfile: /var/run/popular/pserv.pid PATH=/sbin:/bin:/usr/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin # Source function library. . /etc/init.d/functions # Get config. [ -f /etc/popular/options ] || exit 1 . /etc/popular/options [ -x $POPULAR_PREFIX/sbin/pserv ] || exit 1 [ -f /etc/popular/pserv.rc ] || exit 1 RETVAL=0 start(){ if [ "$TCP_KEEPALIVE" ]; then echo "Setting TCP keepalive timer to $TCP_KEEPALIVE seconds" echo $TCP_KEEPALIVE >/proc/sys/net/ipv4/tcp_keepalive_time fi echo -n "Starting POPular pserv: " daemon --user $POPULAR_USER $POPULAR_PREFIX/sbin/pserv $PSERV_FLAGS RETVAL=$? echo if [ "$RETVAL"="0" ]; then sleep 1 su $POPULAR_USER -c "$POPULAR_PREFIX/bin/pcontrol -p pserv /etc/popular/pserv.rc" fi touch /var/lock/subsys/pserv return $RETVAL } stop(){ echo -n "Stopping POPular pserv: " killproc pserv RETVAL=$? echo rm -f /var/run/popular/pserv.* rm -f /var/lock/subsys/pserv return $RETVAL } reload(){ stop start } restart(){ stop start } condrestart(){ [ -e /var/lock/subsys/pserv ] && restart return 0 } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status pserv ;; restart) restart ;; reload) reload ;; condrestart) condrestart ;; *) echo "Usage: pserv {start|stop|status|restart|condrestart|reload}" RETVAL=1 esac exit $RETVAL