]>
Commit | Line | Data |
---|---|---|
c81b1a7a | 1 | #!/bin/sh |
2 | # | |
3 | # sendmail This shell script takes care of starting and stopping | |
4 | # sendmail. | |
5 | # | |
6 | # chkconfig: 2345 80 30 | |
7 | # description: Sendmail is a Mail Transport Agent, which is the program \ | |
c99e5551 | 8 | # that moves mail from one machine to another. |
c81b1a7a | 9 | |
10 | # Source function library. | |
11 | . /etc/rc.d/init.d/functions | |
12 | ||
13 | # Source networking configuration. | |
14 | . /etc/sysconfig/network | |
15 | ||
c81b1a7a | 16 | # Check that networking is up. |
c99e5551 | 17 | [ "${NETWORKING}" = "no" ] && exit 0 |
c81b1a7a | 18 | |
19 | [ -f /usr/sbin/sendmail ] || exit 0 | |
20 | ||
c99e5551 | 21 | # Get config from /etc/sysconfig ... |
22 | if [ -f /etc/sysconfig/sendmail ]; then | |
23 | . /etc/sysconfig/sendmail | |
24 | fi | |
25 | ||
c81b1a7a | 26 | # See how we were called. |
27 | case "$1" in | |
28 | start) | |
29 | # Start daemons. | |
c99e5551 | 30 | show Prepare sendmail db |
31 | busy | |
32 | newaliases &>/dev/null | |
33 | for i in virtusertable access domaintable mailertable | |
34 | do | |
35 | if [ -f /etc/mail/$i ] ; then | |
36 | makemap -v hash /etc/mail/$i < /etc/mail/$i | |
37 | fi | |
38 | done | |
39 | deltext;ok | |
40 | show Starting sendmail | |
41 | daemon sendmail $SENDMAIL_CF | |
c81b1a7a | 42 | touch /var/lock/subsys/sendmail |
43 | ;; | |
44 | stop) | |
45 | # Stop daemons. | |
c99e5551 | 46 | show Shutting down sendmail |
c81b1a7a | 47 | killproc sendmail |
c81b1a7a | 48 | rm -f /var/lock/subsys/sendmail |
49 | ;; | |
50 | restart) | |
51 | $0 stop | |
52 | $0 start | |
53 | ;; | |
54 | status) | |
55 | status sendmail | |
56 | ;; | |
57 | *) | |
c99e5551 | 58 | echo "Usage: $0 {start|stop|restart|status}" |
c81b1a7a | 59 | exit 1 |
60 | esac | |
61 | ||
62 | exit 0 | |
63 |