#! /bin/sh # # crond Start/Stop Postfix Policy Daemon # # chkconfig: 2345 77 31 # description: policyd is an anti-spam plugin for Postfix # processname: policyd # config: /etc/policyd/policyd.conf # pidfile: /var/run/policyd.pid WITHOUT_RC_COMPAT=1 # Source function library. . /etc/init.d/functions PIDFILE=/var/run/policyd.pid LOCKFILE=/var/lock/subsys/policyd CONFIGFILE=/etc/policyd/policyd.conf USER=_policyd RETVAL=0 [ -f $CONFIG ] || ( echo "policyd does not configured yet!" echo "Create config file $CONFIG and try run service again." echo "Sample config file could be found in $CONFIG.sample." echo "You should at least rename in to $CONFIG," echo "and create a MySQL database." exit ); start() { start_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user "$USER" -- policyd -c $CONFIGFILE RETVAL=$? return $RETVAL } stop() { stop_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user "$USER" policyd RETVAL=$? return $RETVAL } restart() { stop start } # See how we were called. case "$1" in start) start ;; stop) stop ;; reload|restart) restart ;; condstop) if [ -e "$LOCKFILE" ]; then stop fi ;; condrestart|condreload) if [ -e "$LOCKFILE" ]; then restart fi ;; status) status --pidfile "$PIDFILE" --expect-user "$USER" policyd RETVAL=$? ;; *) msg_usage "${0##*/} {start|stop|reload|restart|condstop|condrestart|condreload|status}" RETVAL=1 esac exit $RETVAL