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