File: redhat-rc-script.sh

package info (click to toggle)
spamassassin 4.0.2-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 25,724 kB
  • sloc: perl: 89,143; ansic: 5,193; sh: 3,737; javascript: 339; sql: 295; makefile: 209; python: 49
file content (80 lines) | stat: -rwxr-xr-x 1,664 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/sh
#
# spamassassin This script starts and stops the spamd daemon
#
# chkconfig: - 78 30
# processname: spamd
# description: spamd is a daemon process which uses SpamAssassin to check \
#              email messages for SPAM.  It is normally called by spamc \
#	       from a MDA.

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

prog="spamd"

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

# Set default spamd configuration.
SPAMDOPTIONS="-d -c -m5 -H"
SPAMD_PID=/var/run/spamd.pid

# Source spamd configuration.
if [ -f /etc/sysconfig/spamassassin ] ; then
	. /etc/sysconfig/spamassassin
fi

[ -f /usr/bin/spamd -o -f /usr/local/bin/spamd ] || exit 0
PATH=$PATH:/usr/bin:/usr/local/bin

# By default it's all good
RETVAL=0

# See how we were called.
case "$1" in
  start)
	# tell portreserve to release the port
	[ -x /sbin/portrelease ] && /sbin/portrelease spamd &>/dev/null || :
	# Start daemon.
	echo -n $"Starting $prog: "
	daemon $NICELEVEL spamd $SPAMDOPTIONS -r $SPAMD_PID
	RETVAL=$?
        echo
	if [ $RETVAL = 0 ]; then
		touch /var/lock/subsys/spamd
	fi
        ;;
  stop)
        # Stop daemons.
        echo -n $"Stopping $prog: "
        killproc spamd
        RETVAL=$?
        echo
	if [ $RETVAL = 0 ]; then
		rm -f /var/lock/subsys/spamd
		rm -f $SPAMD_PID
	fi
        ;;
  restart)
        $0 stop
	sleep 3
        $0 start
        ;;
  condrestart)
       [ -e /var/lock/subsys/spamd ] && $0 restart
       ;;
  status)
	status spamd
	RETVAL=$?
	;;
  *)
	echo "Usage: $0 {start|stop|restart|status|condrestart}"
	RETVAL=1
	;;
esac

exit $RETVAL