1#!/bin/sh
2#
3# amavisd	This script controls the amavisd-new daemon.
4#		(to be used with version amavisd-new-20020630 or later)
5#
6
7# chkconfig: 2345 79 31
8# description: amavisd is an interface between MTA and content checkers
9# processname: amavisd
10# pidfile: /var/amavis/amavisd.pid
11
12# Source function library.
13. /etc/rc.d/init.d/functions
14
15# Source networking configuration.
16. /etc/sysconfig/network
17
18#prog="/opt/amavisd-new/sbin/amavisd"
19prog="/usr/sbin/amavisd"
20prog_base="$(basename ${prog})"
21
22prog_config_file="/etc/amavisd.conf"
23
24# Source configuration.
25[ -e /etc/sysconfig/${prog_base} ] && . /etc/sysconfig/${prog_base}
26
27## Check that networking is up.
28#[ ${NETWORKING} = "no" ] && exit 0
29
30RETVAL=0
31
32# See how we were called.
33case "$1" in
34  start)
35	action $"Starting ${prog_base}:" ${prog} -c ${prog_config_file}
36	RETVAL=$?
37	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/${prog_base}
38	echo
39	;;
40  stop)
41	action $"Shutting down ${prog_base}:" ${prog} -c ${prog_config_file} stop
42	RETVAL=$?
43	if [ $RETVAL -eq 0 ] ; then
44	        echo "${prog_base} stopped"
45        	rm -f /var/lock/subsys/${prog_base}
46	else
47		echo
48	fi
49	;;
50  status)
51	status ${prog_base}
52	RETVAL=$?
53	;;
54  restart)
55	$0 stop
56	$0 start
57	RETVAL=$?
58	;;
59  reload)
60	action $"Reloading ${prog_base}:" ${prog} -c ${prog_config_file} reload
61	RETVAL=$?
62	;;
63  *)
64	echo "Usage: $0 {start|stop|status|restart|reload}"
65	exit 1
66esac
67
68exit $RETVAL
69