#!/bin/sh
# $Id: rc-redhat.sh.in,v 1.7 2006/08/20 05:20:51 manu Exp $
#  init file for milter-greylist
#    modified by MXM for Fedora 9 installation
#    MXM: save as /etc/init.d/milter-greylist
#			chown to user mail
#			chmod to allow it to be run
# chkconfig: - 79 21
# description: Milter Greylist Daemon
#
# processname: @BINDIR@/milter-greylist
# config: /etc/mail/greylist.conf
# pidfile: /var/milter-greylist/milter-greylist.pid

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

pidfile="/var/milter-greylist/milter-greylist.pid"
socket="/var/milter-greylist/milter-greylist.sock"
#  original read:
#user="@USER@"
#  MXM--this works for my setup:
user="mail"

OPTIONS="-P $pidfile -p $socket"
if [ -f /etc/sysconfig/milter-greylist ]
then
    . /etc/sysconfig/milter-greylist
fi
RETVAL=0
prog="Milter-Greylist"
#
# original file read:
#   daemon --user=$user @BINDIR@/milter-greylist $OPTIONS
# MXM: changed @BINDIR@ to /usr/local/bin
#
start() {
        echo -n $"Starting $prog: "
        if [ $UID -ne 0 ]; then
                RETVAL=1
                failure
        else
                daemon --user=$user /usr/local/bin/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 @BINDIR@/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.txt · Last modified: 2023/08/12 19:17 by 127.0.0.1
 
Recent changes RSS feed Creative Commons License Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki