]> git.pld-linux.org Git - packages/sendmail.git/blob - sendmail.init
- added man to BR
[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_yes "${NETWORKING}"; then
29         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
30                 msg_network_down Sendmail
31                 exit 1
32         fi
33 else
34         exit 0
35 fi
36
37 RETVAL=0
38 # See how we were called.
39 case "$1" in
40   start)
41         # Check if the service is already running?
42         if [ ! -f /var/lock/subsys/sendmail ]; then
43                 show "Prepare sendmail db"
44                 busy
45                 /usr/bin/newaliases >/dev/null 2>&1
46                 for i in virtusertable access domaintable mailertable; do
47                         if [ -f /etc/mail/$i ]; then
48                                 makemap -v hash /etc/mail/$i < /etc/mail/$i >/dev/null 2>&1
49                                 [ $RETVAL -eq 0 ] && RETVAL=$?
50                         fi
51                 done 
52                 [ $RETVAL -eq 0 ] && ok || fail
53                 msg_starting sendmail
54                 daemon /usr/sbin/sendmail $([ "$DAEMON" = "yes" ] && echo -bd) \
55                                         $([ -n "$QUEUE" ] && echo -q$QUEUE) \
56                                         $([ "$ENABLE_IPV6" = "yes" ] && 
57                                                 echo -ODaemonPortOptions=Family=inet6 )
58                 RETVAL=$?
59                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sendmail
60         else
61                 msg_already_running sendmail
62         fi
63         ;;
64   stop)
65         if [ -f /var/lock/subsys/sendmail ]; then
66                 # Stop daemons.
67                 msg_stopping sendmail
68                 killproc sendmail
69                 rm -f /var/lock/subsys/sendmail
70         else
71                 msg_not_running sendmail
72         fi
73         ;;
74   restart|force-reload)
75         $0 stop
76         $0 start
77         exit $?
78         ;;
79   status)
80         status sendmail
81         exit $?
82         ;;
83   *)
84         msg_usage "$0 {start|stop|restart|force-reload|status}"
85         exit 3
86 esac
87
88 exit $RETVAL
This page took 0.079117 seconds and 3 git commands to generate.