Sample milter-greylist script (Fedora yum)

#!/bin/sh
# $Id: rc-redhat.sh.in,v 1.7 2006/08/20 05:20:51 manu Exp $
#  init file for milter-greylist
#
# chkconfig: - 79 21
# description: Milter Greylist Daemon
#
# processname: /usr/sbin/milter-greylist
# config: /etc/mail/greylist.conf
# pidfile: /var/run/milter-greylist.pid

# source function library
. /etc/init.d/functions

pidfile="/var/run/milter-greylist.pid"
OPTIONS="-P $pidfile"
if [ -f /etc/sysconfig/milter-greylist ]
then
    . /etc/sysconfig/milter-greylist
fi
RETVAL=0
prog="Milter-Greylist"

start() {
        echo -n $"Starting $prog: "
        if [ $UID -ne 0 ]; then
                RETVAL=1
                failure
        else
                daemon /usr/sbin/milter-greylist $OPTIONS
                RETVAL=$?
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/milter-greylist
                [ $RETVAL -eq 0 ] && success || failure
        fi;
        echo
        return $RETVAL
}

stop() {
        echo -n $"Stopping $prog: "
        if [ $UID -ne 0 ]; then
                RETVAL=1
                failure
        else
                killproc /usr/sbin/milter-greylist
                RETVAL=$?
                [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/milter-greylist
                [ $RETVAL -eq 0 ] && success || failure
        fi;
        echo
        return $RETVAL
}


restart(){
        stop
        start
}

condrestart(){
    [ -e /var/lock/subsys/milter-greylist ] && restart
    return 0
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  condrestart)
        condrestart
        ;;
  status)
        status milter-greylist
        RETVAL=$?
        ;;
  *)
        echo $"Usage: $0 {start|stop|status|restart|condrestart}"
        RETVAL=1
esac

exit $RETVAL
 
blog/sample-milter-greylist-script-fedora-yum.txt · Last modified: 2017/07/14 04:33 (external edit)
 
Recent changes RSS feed Creative Commons License Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki