]> git.pld-linux.org Git - packages/sendmail.git/blob - sendmail.init
- official sec patch
[packages/sendmail.git] / sendmail.init
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 \
8 #               that moves mail from one machine to another.
9 # pidfile:      /var/run/sendmail.pid
10
11
12 # Source function library
13 . /etc/rc.d/init.d/functions
14
15 # Get network config
16 . /etc/sysconfig/network
17
18 # Get service config
19 if [ -f /etc/sysconfig/sendmail ]; then
20         . /etc/sysconfig/sendmail
21 else
22         DAEMON=yes
23         QUEUE=1h                                                                                              
24         ENABLE_IPV6=yes
25 fi
26
27 # Check that networking is up.
28 if is_no "${NETWORKING}"; then
29         msg_network_down Sendmail
30         exit 1
31 fi
32
33 # See how we were called.
34 case "$1" in
35   start)
36         # Check if the service is already running?
37         if [ ! -f /var/lock/subsys/sendmail ]; then
38                 show "Prepare sendmail db"
39                 busy
40                 /usr/bin/newaliases >/dev/null 2>&1
41                 for i in virtusertable access domaintable mailertable; do
42                         if [ -f /etc/mail/$i ] ; then
43                                 makemap -v hash /etc/mail/$i < /etc/mail/$i >/dev/null 2>&1
44                         fi
45                 done 
46                 deltext;ok
47                 msg_starting sendmail
48                 daemon /usr/sbin/sendmail $([ "$DAEMON" = "yes" ] && echo -bd) \
49                                         $([ -n "$QUEUE" ] && echo -q$QUEUE) \
50                                         $([ "$ENABLE_IPV6" = "yes" ] && 
51                                                 echo -ODaemonPortOptions=Family=inet6 )
52                 RETVAL=$?
53                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sendmail
54         else
55                 msg_already_running sendmail
56                 exit 1
57         fi
58         ;;
59   stop)
60         # Stop daemons.
61         msg_stopping sendmail
62         killproc sendmail
63         RETVAL=$?
64         [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sendmail
65         ;;
66   restart|reload)
67         $0 stop
68         $0 start
69         ;;
70   condrestart)
71         if [ -f /var/lock/subsys/sendmail ]; then
72             stop
73             start
74             RETVAL=$?
75         fi
76         ;;
77   status)
78         status sendmail
79         RETVAL=$?
80         ;;
81   *)
82         msg_usage "$0 {start|stop|restart|reload|condrestart|status}"
83         exit 1
84 esac
85
86 exit $RETVAL
This page took 0.027474 seconds and 3 git commands to generate.