0
|
1 #! /bin/sh
|
|
2 # Author: Oliver Kurth <okurth@uni-sw.gwdg.de>
|
|
3 #
|
|
4 # /sbin/init.d/masqmail
|
|
5 #
|
|
6
|
|
7 . /etc/rc.config
|
|
8
|
|
9 # Determine the base and follow a runlevel link name.
|
|
10 base=${0##*/}
|
|
11 link=${base#*[SK][0-9][0-9]}
|
|
12
|
|
13 # Force execution if not called by a runlevel directory.
|
|
14 test $link = $base && SMTP=yes
|
|
15 test "$SMTP" = yes || exit 0
|
|
16
|
|
17 if test -z "$MASQMAIL_ARGS" ; then
|
|
18 MASQMAIL_ARGS="-bd -q30m"
|
|
19 fi
|
|
20
|
|
21 # The echo return value for success (defined in /etc/rc.config).
|
|
22 return=$rc_done
|
|
23 case "$1" in
|
|
24 start)
|
|
25 echo -n "Starting SMTP (MasqMail)"
|
|
26 ## Start daemon with startproc(8). If this fails
|
|
27 ## the echo return value is set appropriate.
|
|
28
|
|
29 startproc /usr/sbin/sendmail $MASQMAIL_ARGS || return=$rc_failed
|
|
30
|
|
31 echo -e "$return"
|
|
32 ;;
|
|
33 stop)
|
|
34 echo -n "Shutting down SMTP (MasqMail)"
|
|
35 ## Stop daemon with killproc(8) and if this fails
|
|
36 ## set echo the echo return value.
|
|
37
|
|
38 killproc -TERM /usr/sbin/sendmail || return=$rc_failed
|
|
39
|
|
40 echo -e "$return"
|
|
41 ;;
|
|
42 restart)
|
|
43 ## If first returns OK call the second, if first or
|
|
44 ## second command fails, set echo return value.
|
|
45 $0 stop && $0 start || return=$rc_failed
|
|
46 ;;
|
|
47 reload)
|
|
48 ## Choose ONE of the following two cases:
|
|
49
|
|
50 ## First possibility: A few services accepts a signal
|
|
51 ## to reread the (changed) configuration.
|
|
52
|
|
53 #echo -n "Reload service MasqMail"
|
|
54 #killproc -HUP /usr/sbin/sendmail || return=$rc_failed
|
|
55 #echo -e "$return"
|
|
56
|
|
57 ## Exclusive possibility: Some services must be stopped
|
|
58 ## and started to force a new load of the configuration.
|
|
59
|
|
60 $0 stop && $0 start || return=$rc_failed
|
|
61 ;;
|
|
62 status)
|
|
63 echo -n "Checking for service SMTP (MasqMail): "
|
|
64 ## Check status with checkproc(8), if process is running
|
|
65 ## checkproc will return with exit status 0.
|
|
66
|
|
67 checkproc /usr/sbin/sendmail && echo OK || echo No process
|
|
68 ;;
|
|
69 # probe)
|
|
70 ## Optional: Probe for the necessity of a reload,
|
|
71 ## give out the argument which is required for a reload.
|
|
72
|
|
73 # test /usr/exim/configure -nt /var/lock/exim.pid && echo reload
|
|
74 # ;;
|
|
75 *)
|
|
76 echo "Usage: $0 {start|stop|status|restart|reload|probe}"
|
|
77 exit 1
|
|
78 ;;
|
|
79 esac
|
|
80
|
|
81 # Inform the caller not only verbosely and set an exit status.
|
|
82 test "$return" = "$rc_done" || exit 1
|
|
83 exit 0
|