11 |
# config: /etc/qpsmtpd |
# config: /etc/qpsmtpd |
12 |
# pidfile: /var/run/qpsmtpd-forkserver.pid |
# pidfile: /var/run/qpsmtpd-forkserver.pid |
13 |
|
|
14 |
|
|
15 |
# Source function library. |
# Source function library. |
16 |
. /etc/init.d/functions |
. /etc/init.d/functions |
17 |
. /etc/sysconfig/qpsmtpd-forkserver |
. /etc/sysconfig/qpsmtpd-forkserver |
23 |
prog="qpsmtpd-forkserver" |
prog="qpsmtpd-forkserver" |
24 |
|
|
25 |
start() { |
start() { |
26 |
|
# cleanup environment a bit. |
27 |
|
unset PERL_UNICODE |
28 |
|
unset LANG |
29 |
|
unset LC_TIME |
30 |
|
unset LC_ALL |
31 |
|
unset BASH_ENV |
32 |
|
unset ENV |
33 |
|
unset CDPATH |
34 |
|
unset IFS |
35 |
|
|
36 |
echo -n $"Starting $prog: " |
echo -n $"Starting $prog: " |
37 |
trap "" 1 |
trap "" 1 |
38 |
nohup qpsmtpd-forkserver $QPSMTPD_OPTIONS 2>&1 | |
daemon $prog --detach $QPSMTPD_OPTIONS |
|
/usr/local/bin/ts $TS_OPTIONS & |
|
39 |
RETVAL=$? |
RETVAL=$? |
40 |
echo |
echo |
41 |
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/qpsmtpd-forkserver |
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog |
42 |
return $RETVAL |
return $RETVAL |
43 |
} |
} |
44 |
|
|
45 |
stop() { |
stop() { |
46 |
echo -n $"Stopping $prog: " |
echo -n $"Stopping $prog: " |
47 |
killproc qpsmtpd-forkserver |
killproc $prog |
48 |
RETVAL=$? |
RETVAL=$? |
49 |
echo |
echo |
50 |
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/qpsmtpd-forkserver |
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog |
51 |
return $RETVAL |
return $RETVAL |
52 |
} |
} |
53 |
|
|
54 |
rhstatus() { |
# functions status() uses pidof, which doesn't work with (?) scripts |
55 |
status qpsmtpd-forkserver |
qpstatus() { |
56 |
} |
local base=${1##*/} |
57 |
|
local pid |
58 |
|
|
59 |
|
# Test syntax. |
60 |
|
if [ "$#" = 0 ] ; then |
61 |
|
echo $"Usage: status {program}" |
62 |
|
return 1 |
63 |
|
fi |
64 |
|
|
65 |
|
# Use "/var/run/*.pid" file for pid |
66 |
|
if [ -f /var/run/${base}.pid ] ; then |
67 |
|
read pid < /var/run/${base}.pid |
68 |
|
if [ -n "$pid" ]; then |
69 |
|
/bin/ps -p $pid >/dev/null |
70 |
|
if [ $? -eq 0 ]; then |
71 |
|
echo $"${base} (pid $pid) is running..." |
72 |
|
return 0 |
73 |
|
else |
74 |
|
echo $"${base} dead but pid file exists" |
75 |
|
return 1 |
76 |
|
fi |
77 |
|
fi |
78 |
|
fi |
79 |
|
# See if /var/lock/subsys/${base} exists |
80 |
|
if [ -f /var/lock/subsys/${base} ]; then |
81 |
|
echo $"${base} dead but subsys locked" |
82 |
|
return 2 |
83 |
|
fi |
84 |
|
echo $"${base} is stopped" |
85 |
|
return 3 |
86 |
|
} |
87 |
|
|
88 |
restart() { |
restart() { |
89 |
stop |
stop |
109 |
reload |
reload |
110 |
;; |
;; |
111 |
status) |
status) |
112 |
rhstatus |
qpstatus qpsmtpd-forkserver |
113 |
;; |
;; |
114 |
condrestart) |
condrestart) |
115 |
[ -f /var/lock/subsys/qpsmtpd-forkserver ] && restart || : |
[ -f /var/lock/subsys/$prog ] && restart || : |
116 |
;; |
;; |
117 |
*) |
*) |
118 |
echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}" |
echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}" |