]> git.pld-linux.org Git - packages/postfix.git/blob - postfix.init
Standarized all rc scripts.
[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 [ "${NETWORKING}" = "no" ] && echo "Error: Networking is down"; exit 0
23
24
25 # See how we were called.
26 case "$1" in
27   start)
28         # Check if the service is already running?
29         if [ ! -f /var/lock/subsys/postfix ]; then
30                 show Starting postfix
31                 busy
32                 newaliases
33                 $0 rebuilddb
34                 if /usr/sbin/postfix start 2>/dev/null; then
35                         deltext; ok
36                 else
37                         deltext;fail
38                 fi
39         else
40                 echo "postfix already is running"
41         fi
42         touch /var/lock/subsys/postfix
43         ;;
44   stop)
45         # Stop daemons.
46         show "Shutting down postfix: "
47         busy
48         if /usr/sbin/postfix stop 2>/dev/null; then
49                 deltext; ok
50         else
51                 deltext; fail
52         fi
53         rm -f /var/lock/subsys/postfix
54         ;;
55   restart)
56         $0 stop
57         $0 start
58         ;;
59   reload)
60         /usr/sbin/postfix reload
61         ;;
62   status)
63         status postfix
64         ;;
65   rebuilddb)
66         for I in access canonical relocated transport virtual; do
67                 if [ -f /etc/mail/$I ] ; then
68                         /usr/sbin/postmap hash:/etc/mail/$I < /etc/mail/$I
69                 fi
70         done
71         ;;
72   *)
73         echo "Usage: $0 {start|stop|status|restart|reload|rebuilddb}"
74         exit 1
75 esac
76
77 exit 0
This page took 0.134367 seconds and 4 git commands to generate.