#!/bin/sh
#
# noattach	Script to start/stop the noattach.
#
# chkconfig:	- 76 24
# description:	Noattach is an attachment filter for sendmail.
#
# processname: noattach
# config: /usr/local/etc/noattach.patterns
# pidfile: /var/run/noattach.pid

# Source function library
. /etc/rc.d/init.d/functions

# Get network config
. /etc/sysconfig/network

test -f /usr/local/etc/noattach.patterns || exit 0

RETVAL=0

start() {
	echo -n $"Starting noattach milter: "
	daemon /usr/bin/noattach -p local:/var/run/noattach/noattach.sock
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/noattach
	return $RETVAL
}

stop() {
	echo -n $"Stopping noattach milter: "
	killproc noattach
	RETVAL=$?
	echo
	rm -f /var/run/noattach/noattach.sock /var/lock/subsys/noattach
	return $RETVAL
}

restart() {
	stop
	start
}

reload() {
        echo -n $"Reloading patterns: "
        killproc noattach -USR1
        RETVAL=$?
        echo
        return $RETVAL
}


case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  status)
	status noattach
	;;
  restart)
	restart
	;;
  condrestart)
	[ -f /var/lock/subsys/noattach ] && restart || :
	;;
  reload)
	reload
	;;
  *)
	echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
	exit 1
esac

exit $?



syntax highlighted by Code2HTML, v. 0.9.1