]> git.pld-linux.org Git - packages/postfix.git/blob - postfix.init
*** empty log message ***
[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:    345 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                 MSG="`/usr/sbin/postfix start 2>&1`"
35                 if [ "$?" = "0" ] ; then
36                         deltext; ok
37                         touch /var/lock/subsys/postfix
38                 else
39                         deltext; fail
40                         echo "$MSG"
41                 fi
42         else
43                 msg_Already_Running Postfix
44         fi
45         ;;
46   stop)
47         # Stop daemons.
48         if [ -f /var/lock/subsys/postfix ]; then
49                 msg_stopping Postfix
50                 busy
51                 MSG="`/usr/sbin/postfix stop 2>&1`"
52                 if [ "$?" = "0" ]; then
53                         deltext; ok
54                 else
55                         deltext; fail
56                         echo "$MSG"
57                 fi
58                 rm -f /var/lock/subsys/postfix
59         else
60                 msg_Not_Running Postfix
61                 exit 1
62         fi
63         ;;
64   restart)
65         $0 stop
66         $0 start
67         ;;
68   reload)
69         /usr/sbin/postfix reload
70         ;;
71   status)
72         status master
73         exit $?
74         ;;
75   rebuilddb)
76         standard_db="access canonical relocated transport virtual"
77         extra_db=$(ls -1 /etc/mail/*.db 2> /dev/null | sed -e 's#.db$##')
78         for base in $standard_db $extra_db; do
79                 I=$(basename "$base")
80                 if [ -f /etc/mail/$I ] ; then
81                         /usr/sbin/postmap hash:/etc/mail/$I < /etc/mail/$I
82                 fi
83         done
84         ;;
85   *)
86         msg_Usage "$0 {start|stop|status|restart|reload|rebuilddb}"
87         exit 1
88 esac
89
90 exit $RETVAL
This page took 0.08873 seconds and 4 git commands to generate.