blob: d32df5c064f3a7607a96639ac093dc2679019643 (
plain) (
blame)
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
|
#!/bin/sh
if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then
echo "$0: Cannot determine the PREFIX" >&2
exit 1
fi
NULLMAILUSER=nullmail
PIDFILE=/var/run/nullmailer.pid
AWK=/usr/bin/awk
CAT=/bin/cat
GREP=/usr/bin/grep
PS=/bin/ps
RM=/bin/rm
LOGGER=/usr/bin/logger
KILL=/bin/kill
KILLALL=/usr/bin/killall
HEAD=/usr/bin/head
PRIORITY=local5.info
TAG=${NULLMAILUSER}
case "$1" in
start)
echo -n ' nullmailer'
if [ ! -r ${PIDFILE} ] ; then
[ -x ${PREFIX}/sbin/nullmailer-send ] && su -l ${NULLMAILUSER} -c "${PREFIX}/sbin/nullmailer-send 2>&1 | ${LOGGER} -i -p ${PRIORITY} -t ${TAG} &"
JUNK=`${PS} -ax`
PID=`${PS} awx | ${GREP} -v awk | ${AWK} '/nullmailer-send/ {print $1}' | ${HEAD} -1`
echo $PID > ${PIDFILE}
else
echo ' already running'
fi
;;
stop)
echo -n ' nullmailer'
if [ -r ${PIDFILE} ] ; then
${KILL} `${CAT} ${PIDFILE}` > /dev/null
${RM} -f ${PIDFILE}
fi
;;
*)
echo "Usage: `basename $0` {start|stop}" >&2
;;
esac
exit 0
|