]>
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. |
7a537bd8 JR |
22 | if is_no "${NETWORKING}"; then |
23 | msg_Network_Down Sendmail | |
d402e605 | 24 | exit 1 |
25 | fi | |
c81b1a7a | 26 | |
27 | # See how we were called. | |
28 | case "$1" in | |
29 | start) | |
56e84bcc | 30 | # Check if the service is already running? |
31 | if [ ! -f /var/lock/subsys/sendmail ]; then | |
7a537bd8 | 32 | show "Prepare sendmail db" |
56e84bcc | 33 | busy |
d730b467 | 34 | newaliases >/dev/null 2>&1 |
56e84bcc | 35 | for i in virtusertable access domaintable mailertable; do |
36 | if [ -f /etc/mail/$i ] ; then | |
d730b467 | 37 | makemap -v hash /etc/mail/$i < /etc/mail/$i >/dev/null 2>&1 |
56e84bcc | 38 | fi |
39 | done | |
40 | deltext;ok | |
7a537bd8 | 41 | msg_starting sendmail |
d730b467 | 42 | daemon /usr/sbin/sendmail $SENDMAIL_CF |
56e84bcc | 43 | else |
7a537bd8 JR |
44 | msg_Already_Running sendmail |
45 | exit 1 | |
c99e5551 | 46 | fi |
c81b1a7a | 47 | touch /var/lock/subsys/sendmail |
48 | ;; | |
49 | stop) | |
50 | # Stop daemons. | |
7a537bd8 | 51 | msg_stopping sendmail |
c81b1a7a | 52 | killproc sendmail |
c81b1a7a | 53 | rm -f /var/lock/subsys/sendmail |
54 | ;; | |
56e84bcc | 55 | restart|reload) |
c81b1a7a | 56 | $0 stop |
57 | $0 start | |
58 | ;; | |
59 | status) | |
60 | status sendmail | |
61 | ;; | |
62 | *) | |
7a537bd8 | 63 | msg_Usage "$0 {start|stop|staus|restart|reload}" |
c81b1a7a | 64 | exit 1 |
65 | esac | |
66 | ||
67 | exit 0 | |
68 |