]> git.pld-linux.org Git - packages/postfix.git/blob - postfix.init
- updated to 19990906_pl05
[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 [ "${NETWORKING}" = "no" ]; then
23         echo "WARNING: Networking is down. Postfix service can't be runed."
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                 show 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                 else
40                         deltext; fail
41                         echo "$MSG"
42                 fi
43         else
44                 echo "postfix already is running"
45         fi
46         touch /var/lock/subsys/postfix
47         ;;
48   stop)
49         # Stop daemons.
50         show "Shutting down postfix"
51         busy
52         MSG="`/usr/sbin/postfix stop 2>&1`"
53         if [ "$?" = "0" ]; then
54                 deltext; ok
55         else
56                 deltext; fail
57                 echo "$MSG"
58         fi
59         rm -f /var/lock/subsys/postfix
60         ;;
61   restart)
62         $0 stop
63         $0 start
64         ;;
65   reload)
66         /usr/sbin/postfix reload
67         ;;
68   status)
69         status postfix
70         ;;
71   rebuilddb)
72         for I in access canonical relocated transport virtual; do
73                 if [ -f /etc/mail/$I ] ; then
74                         /usr/sbin/postmap hash:/etc/mail/$I < /etc/mail/$I
75                 fi
76         done
77         ;;
78   *)
79         echo "Usage: $0 {start|stop|status|restart|reload|rebuilddb}"
80         exit 1
81 esac
82
83 exit 0
This page took 0.056612 seconds and 4 git commands to generate.