git-svn-id: file:///var/lib/svn/clamav-devel/branches/0.93@3848 77e5149b-7576-45b1-b177-96237e5ba77b
Török Edvin authored on 2008/05/10 02:10:53... | ... |
@@ -27,28 +27,45 @@ PATH=$PATH:/usr/bin:/usr/local/sbin:/usr/local/bin |
27 | 27 |
|
28 | 28 |
RETVAL=0 |
29 | 29 |
|
30 |
+# Clamav-milter must have write access to the pid file, /var/run is not suitable |
|
31 |
+default_pidfile= |
|
32 |
+[ -d /var/run/clamav-milter ] && default_pidfile=/var/run/clamav-milter/clamav-milter.pid |
|
33 |
+[ -d /var/clamav ] && default_pidfile=/var/clamav/clamav-milter.pid |
|
34 |
+pidfile=${PIDFILE:-$default_pidfile} |
|
35 |
+ |
|
36 |
+lockfile=/var/lock/subsys/clamav-milter |
|
37 |
+ |
|
30 | 38 |
start() { |
31 | 39 |
echo -n "Starting clamav-milter: " |
32 |
- if test -f /var/lock/subsys/clamav-milter; then |
|
33 |
- echo " already running!" |
|
34 |
- return 1 |
|
35 |
- fi |
|
36 |
- # Don't allow files larger than 20M to be created, to limit DoS |
|
40 |
+ # Don't allow files larger than 25M to be created, to limit DoS |
|
37 | 41 |
# Needs to be large enough to extract the signature files |
38 |
- ulimit -f 20000 |
|
39 |
- LANG= daemon clamav-milter ${CLAMAV_FLAGS} |
|
42 |
+ ulimit -f 25600 |
|
43 |
+ if [ ! -z $pidfile ]; then |
|
44 |
+ CLAMAV_PID=--pidfile=${pidfile} |
|
45 |
+ PID=`pidofproc -p ${pidfile} clamav-milter` |
|
46 |
+ else |
|
47 |
+ CLAMAV_PID= |
|
48 |
+ PID=`pidofproc clamav-milter` |
|
49 |
+ fi |
|
50 |
+ [ -n "$PID" ] && echo " already running!" && return 1 |
|
51 |
+ LANG= daemon clamav-milter $CLAMAV_PID ${CLAMAV_FLAGS} |
|
40 | 52 |
RETVAL=$? |
53 |
+ [ ! -z $pidfile -a -f $pidfile ] && sed -i -e 's/-//' $pidfile |
|
41 | 54 |
echo |
42 |
- test $RETVAL -eq 0 && touch /var/lock/subsys/clamav-milter |
|
55 |
+ test $RETVAL -eq 0 && touch ${lockfile} |
|
43 | 56 |
return $RETVAL |
44 | 57 |
} |
45 | 58 |
|
46 | 59 |
stop() { |
47 | 60 |
echo -n "Shutting down clamav-milter: " |
48 |
- killproc clamav-milter |
|
61 |
+ if [ ! -z $pidfile ]; then |
|
62 |
+ killproc -p ${pidfile} clamav-milter |
|
63 |
+ else |
|
64 |
+ killproc clamav-milter |
|
65 |
+ fi |
|
49 | 66 |
RETVAL=$? |
50 | 67 |
echo |
51 |
- test $RETVAL -eq 0 && rm -f /var/lock/subsys/clamav-milter |
|
68 |
+ test $RETVAL -eq 0 && rm -f ${lockfile} ${pidfile} |
|
52 | 69 |
} |
53 | 70 |
|
54 | 71 |
restart() { |
... | ... |
@@ -70,10 +87,14 @@ case "$1" in |
70 | 70 |
restart |
71 | 71 |
;; |
72 | 72 |
condrestart) |
73 |
- test -f /var/lock/subsys/clamav-milter && $0 restart || : |
|
73 |
+ test -f ${lockfile} && $0 restart || : |
|
74 | 74 |
;; |
75 | 75 |
status) |
76 |
- status clamav-milter |
|
76 |
+ if [ ! -z $pidfile ]; then |
|
77 |
+ status -p ${pidfile} clamav-milter |
|
78 |
+ else |
|
79 |
+ status clamav-milter |
|
80 |
+ fi |
|
77 | 81 |
;; |
78 | 82 |
*) |
79 | 83 |
echo "Usage: $0 {start|stop|reload|restart|condrestart|status}" |