Mercurial > notdcc
comparison misc/rcDCC.in @ 0:c7f6b056b673
First import of vendor version
author | Peter Gervai <grin@grin.hu> |
---|---|
date | Tue, 10 Mar 2009 13:49:58 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c7f6b056b673 |
---|---|
1 #!/bin/sh | |
2 | |
3 # chkconfig: 2345 40 80 | |
4 # description: rcDCC is a startup script for DCC http://www.rhyolite.com/dcc/ | |
5 # processname: dccd | |
6 # processname: dccm | |
7 # processname: dccifd | |
8 | |
9 ### BEGIN INIT INFO | |
10 # Provides: dccd dccm dccifd | |
11 # Required-Start: $network $named $syslog $time | |
12 # Should-Start: ypbind sendmail | |
13 # Required-Stop: | |
14 # Should-Stop: | |
15 # Default-Start: 3 5 | |
16 # Default-Stop: | |
17 # Short-Description: DCC daemons providing mail filtering | |
18 # Description: Start dccm, dccifd, and/or dccd to support DCC mail | |
19 # filtering via sendmail, postfix, or SpamAssassin | |
20 ### END INIT INFO | |
21 | |
22 | |
23 | |
24 # start or stop dccd, dccifd, and dccm for Solaris, System V, IRIX, | |
25 # Redhat Linux, or FreeBSD | |
26 | |
27 # dccm must be started before sendmail and stopped after sendmail to avoid | |
28 # complaints from sendmail | |
29 # dccd must be should before the first mail message arrives | |
30 # Thus on some Solaris systems, this script can be installed as | |
31 # rc0.d/K37DCC rc1.d/K37DCC rc2.d/S88DCC rcS.d/K37DCC | |
32 # On some Linux systems it can be installed as rc.d/init.d/DCC and linked | |
33 # to rc.d/rc0.d/K31DCC rc.d/rc1.d/K31DCC rc.d/rc2.d/S80DCC rc.d/rc3.d/S80DCC | |
34 # rc.d/rc4.d/S80DCC rc.d/rc5.d/S80DCC and rc.d/rc6.d/K31DCC | |
35 # On other Linux systems such as SUSE, link this script to /etc/init.d/DCC and | |
36 # run `insserv DCC` | |
37 # On FreeBSD 5.* and 6.* systems, link this file to | |
38 # /usr/local/etc/rc.d/rcDCC.sh | |
39 | |
40 | |
41 # Copyright (c) 2008 by Rhyolite Software, LLC | |
42 # | |
43 # This agreement is not applicable to any entity which sells anti-spam | |
44 # solutions to others or provides an anti-spam solution as part of a | |
45 # security solution sold to other entities, or to a private network | |
46 # which employs the DCC or uses data provided by operation of the DCC | |
47 # but does not provide corresponding data to other users. | |
48 # | |
49 # Permission to use, copy, modify, and distribute this software without | |
50 # changes for any purpose with or without fee is hereby granted, provided | |
51 # that the above copyright notice and this permission notice appear in all | |
52 # copies and any distributed versions or copies are either unchanged | |
53 # or not called anything similar to "DCC" or "Distributed Checksum | |
54 # Clearinghouse". | |
55 # | |
56 # Parties not eligible to receive a license under this agreement can | |
57 # obtain a commercial license to use DCC by contacting Rhyolite Software | |
58 # at sales@rhyolite.com. | |
59 # | |
60 # A commercial license would be for Distributed Checksum and Reputation | |
61 # Clearinghouse software. That software includes additional features. This | |
62 # free license for Distributed ChecksumClearinghouse Software does not in any | |
63 # way grant permision to use Distributed Checksum and Reputation Clearinghouse | |
64 # software | |
65 # | |
66 # THE SOFTWARE IS PROVIDED "AS IS" AND RHYOLITE SOFTWARE, LLC DISCLAIMS ALL | |
67 # WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES | |
68 # OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL RHYOLITE SOFTWARE, LLC | |
69 # BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES | |
70 # OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | |
71 # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, | |
72 # ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | |
73 # SOFTWARE. | |
74 # Rhyolite Software DCC 1.3.103-1.36 $Revision$ | |
75 # @configure_input@ | |
76 | |
77 | |
78 DCC_HOMEDIR=@prefix@ | |
79 DCC_LIBEXEC=@libexecdir@ # in case dcc_conf has disappeared | |
80 . $DCC_HOMEDIR/dcc_conf | |
81 if test -z "$DCC_RUNDIR" -a -n "$DCCM_RUNDIR"; then | |
82 # deal with old dcc_conf files | |
83 DCC_RUNDIR="$DCCM_RUNDIR" | |
84 fi | |
85 | |
86 USAGE="`basename $0`: [-x] [-m dccd|dccifd|dccm|grey] start|stop" | |
87 | |
88 DEBUG= | |
89 DAEMON= | |
90 while getopts "xm:" c; do | |
91 case $c in | |
92 x) set -x; DEBUG=-x;; | |
93 m) if test "$OPTARG" = dccd -o "$OPTARG" = dccifd \ | |
94 -o "$OPTARG" = dccm -o "$OPTARG" = grey; then | |
95 DAEMON=$OPTARG | |
96 else | |
97 echo "unrecognized daemon $OPTARG" 1>&2 | |
98 DAEMON= | |
99 fi | |
100 ;; | |
101 *) echo "$USAGE" 1>&2;; | |
102 esac | |
103 done | |
104 shift `expr $OPTIND - 1 || true` | |
105 | |
106 | |
107 MODULE= | |
108 if test `uname` = Linux; then | |
109 # Convince the Redhat shutdown mechanism to invoke us at shutdown | |
110 # by including this string: | |
111 # . /etc/rc.d/init.d/functions | |
112 | |
113 # Some Linux systems need a module name in /var/lock/subsys that matches | |
114 # the name to which this script is linked to /etc/rc.d/rc?.d for the | |
115 # shutdown or Kxx script. | |
116 MODULE=`basename $0 | sed -n -e 's/^[SK][0-9][0-9]\(.*\)/\1/p'` | |
117 # If @libexecdir@/updatedcc runs @libexecdir@/rcDCC, then the running name | |
118 # of this program will not be the needed module name | |
119 if test -z "$MODULE" -a -d /etc/rc.d; then | |
120 for NM in `find /etc/rc.d -follow -name 'K[0-9][0-9]*dcc*' \ | |
121 -o -name 'K[0-9][0-9]*DCC*'`; do | |
122 if test -n "`grep ddb7d6d95cbf42fd4fdb $NM 2>/dev/null`"; then | |
123 MODULE=`basename $NM | sed -e 's/^K[0-9][0-9]//'` | |
124 break | |
125 fi | |
126 done | |
127 fi | |
128 fi | |
129 | |
130 | |
131 case "$1" in | |
132 start|restart|reload) | |
133 if test -z "$DAEMON" -o "$DAEMON" = dccd; then | |
134 $DCC_LIBEXEC/start-dccd $DEBUG | |
135 fi | |
136 if test -z "$DAEMON" -o "$DAEMON" = grey; then | |
137 $DCC_LIBEXEC/start-grey $DEBUG | |
138 fi | |
139 if test -z "$DAEMON" -o "$DAEMON" = dccm; then | |
140 $DCC_LIBEXEC/start-dccm $DEBUG | |
141 fi | |
142 if test -z "$DAEMON" -o "$DAEMON" = dccifd; then | |
143 $DCC_LIBEXEC/start-dccifd $DEBUG | |
144 fi | |
145 if test -n "$MODULE" -a -d /var/lock/subsys; then | |
146 touch /var/lock/subsys/$MODULE | |
147 fi | |
148 ;; | |
149 | |
150 stop) | |
151 # stop dccm and dccifd | |
152 PIDS= | |
153 if test -z "$DAEMON" -o "$DAEMON" = dccm; then | |
154 PIDS="$PIDS `cat $DCC_RUNDIR/dccm.pid 2>/dev/null`" | |
155 PIDS="$PIDS `cat $DCC_HOMEDIR/dccm.pid 2>/dev/null`" | |
156 fi | |
157 if test -z "$DAEMON" -o "$DAEMON" = dccifd 2>/dev/null; then | |
158 PIDS="$PIDS `cat $DCC_RUNDIR/dccifd.pid 2>/dev/null`" | |
159 PIDS="$PIDS `cat $DCC_HOMEDIR/dccifd.pid 2>/dev/null`" | |
160 fi | |
161 if expr "$PIDS" : '.*[0-9]' >/dev/null; then | |
162 # signal the process group because on Linux systems signaling the | |
163 # main process for a threaded application does not work. | |
164 /bin/kill -15 $PIDS | |
165 fi | |
166 # Tell dccd about operating system shutdown, including deleting | |
167 # dcc_db.hash, which will be rebuilt by dbclean when dccd is restarted. | |
168 if test -z "$DAEMON" -o "$DAEMON" = dccd; then | |
169 $DCC_LIBEXEC/stop-dccd -S $DEBUG | |
170 fi | |
171 if test -z "$DAEMON" -o "$DAEMON" = grey; then | |
172 $DCC_LIBEXEC/stop-dccd -G -S $DEBUG | |
173 fi | |
174 if test -n "$MODULE" -a -f /var/lock/subsys/$MODULE; then | |
175 rm /var/lock/subsys/$MODULE | |
176 fi | |
177 ;; | |
178 | |
179 *) | |
180 echo "$USAGE" 1>&2 | |
181 exit 1 | |
182 ;; | |
183 | |
184 esac | |
185 exit 0 |