]> git.pld-linux.org Git - packages/postfix.git/blob - postfix.init
- rewrited with new functions
[packages/postfix.git] / postfix.init
1 #!/bin/sh
2 #
3 # postfix       This shell script takes care of starting and stopping
4 #               postfix.
5 #
6 # chkconfig:    2345 80 30
7 #
8 # description:  Postfix is a Mail Transport Agent, which is the program
9 #               that moves mail from one machine to another.
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 [ -f /etc/sysconfig/postfix ] && . /etc/sysconfig/postfix
20
21 # Check that networking is up.
22 if is_no "${NETWORKING}"; then
23         msg_Network_Down Postfix
24         exit 1
25 fi
26
27 # See how we were called.
28 case "$1" in
29   start)
30         # Check if the service is already running?
31         if [ ! -f /var/lock/subsys/postfix ]; then
32                 msg_starting Postfix
33                 busy
34                 newaliases
35                 $0 rebuilddb
36                 MSG="`/usr/sbin/postfix start 2>&1`"
37                 if [ "$?" = "0" ] ; then
38                         deltext; ok
39                         touch /var/lock/subsys/postfix
40                 else
41                         deltext; fail
42                         echo "$MSG"
43                 fi
44         else
45                 msg_Already_Running Postfix
46         fi
47         ;;
48   stop)
49         # Stop daemons.
50         if [ -f /var/lock/subsys/postfix ]; then
51                 msg_stopping Postfix
52                 busy
53                 MSG="`/usr/sbin/postfix stop 2>&1`"
54                 if [ "$?" = "0" ]; then
55                         deltext; ok
56                 else
57                         deltext; fail
58                         echo "$MSG"
59                 fi
60                 rm -f /var/lock/subsys/postfix
61         else
62                 msg_Not_Running Postfix
63                 exit 1
64         fi
65         ;;
66   restart)
67         $0 stop
68         $0 start
69         ;;
70   reload)
71         /usr/sbin/postfix reload
72         ;;
73   status)
74         status postfix
75         exit $?
76         ;;
77   rebuilddb)
78         for I in access canonical relocated transport virtual; do
79                 if [ -f /etc/mail/$I ] ; then
80                         /usr/sbin/postmap hash:/etc/mail/$I < /etc/mail/$I
81                 fi
82         done
83         ;;
84   *)
85         msg_Usage "$0 {start|stop|status|restart|reload|rebuilddb}"
86         exit 1
87 esac
88
89 exit $RETVAL
This page took 0.10805 seconds and 4 git commands to generate.