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