]> git.pld-linux.org Git - packages/exim-lite.git/blob - exim.init
- unify msg_not_running usage
[packages/exim-lite.git] / exim.init
1 #!/bin/sh
2 #
3 # exim          This shell script takes care of starting and stopping Exim.
4 #
5 # chkconfig:    2345 80 30
6 # description:  Exim is a Mail Transport Agent, which is the program \
7 #               that moves mail from one machine to another.
8 # processname:  exim
9 # config:       /etc/exim.cf
10 # pidfile:      /var/spool/exim/exim-daemon.pid
11
12 # Source function library.
13 . /etc/rc.d/init.d/functions
14
15 # Source networking configuration.
16 . /etc/sysconfig/network
17
18 # Source exim configureation.
19 if [ -f /etc/sysconfig/exim ]; then
20         . /etc/sysconfig/exim
21 else
22         QUEUE=1h
23 fi
24
25 # Check that networking is up.
26 if is_yes "${NETWORKING}"; then
27         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
28                 msg_network_down Exim
29                 exit 1
30         fi
31 else
32         exit 0
33 fi
34
35 RETVAL=0
36 # See how we were called.
37 case "$1" in
38   start)
39         # Start daemons.
40         if [ ! -f /var/lock/subsys/exim ]; then
41                 msg_starting Exim
42                 daemon exim \
43                         $( is_yes "$ALLOW_TCP_CONNECTIONS" && echo -bd ) \
44                         $( [ -n "$QUEUE" ] && echo -q$QUEUE )
45                 for CONFIG in $EXIM_EXTRA_CONFIGS; do
46                                 msg_starting "Exim ($CONFIG)"
47                                 daemon exim \
48                                         $( is_yes "$ALLOW_TCP_CONNECTIONS" && echo -bd ) \
49                                         $( [ -n "$QUEUE" ] && echo -q$QUEUE ) \
50                                         -C $CONFIG
51                 done
52                 RETVAL=$?
53                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/exim
54         else
55                 msg_already_running Exim
56         fi
57         ;;
58   stop)
59         # Stop daemons.
60         if [ -f /var/lock/subsys/exim ]; then
61                 msg_stopping Exim
62                 killproc --pidfile /var/spool/exim/exim-daemon.pid exim
63                 rm -f /var/lock/subsys/exim >/dev/null 2>&1
64         else
65                 msg_not_running Exim
66         fi
67         ;;
68   restart)
69         $0 stop
70         $0 start
71         exit $?
72         ;;
73   status)
74         status exim
75         exit $?
76         ;;
77   reload|force-reload)
78         if [ -f /var/lock/subsys/exim ]; then
79                 msg_reloading Exim
80                 killproc exim -HUP
81                 RETVAL=$?
82         else
83                 msg_not_running Exim
84                 exit 7
85         fi
86         ;;
87   *)
88         msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
89         exit 3
90 esac
91
92 exit $RETVAL
This page took 0.036901 seconds and 3 git commands to generate.