]> git.pld-linux.org Git - packages/postfix.git/blame_incremental - postfix.init
- 2.4.6
[packages/postfix.git] / postfix.init
... / ...
CommitLineData
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.
22if is_yes "${NETWORKING}"; then
23 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
24 msg_network_down Postfix
25 exit 1
26 fi
27else
28 exit 0
29fi
30
31RETVAL=0
32# See how we were called.
33case "$1" in
34 start)
35 # Check if the service is already running?
36 if [ ! -f /var/lock/subsys/postfix ]; then
37 msg_starting Postfix
38 busy
39 MSG="`/usr/sbin/postfix start 2>&1`"
40 if [ $? -eq 0 ]; then
41 ok
42 touch /var/lock/subsys/postfix
43 else
44 RETVAL=1
45 fail
46 echo "$MSG"
47 fi
48 else
49 msg_already_running Postfix
50 fi
51 ;;
52 stop)
53 # Stop daemons.
54 if [ -f /var/lock/subsys/postfix ]; then
55 msg_stopping Postfix
56 busy
57 MSG="`/usr/sbin/postfix stop 2>&1`"
58 if [ $? -eq 0 ]; then
59 ok
60 else
61 fail
62 echo "$MSG"
63 fi
64 rm -f /var/lock/subsys/postfix
65 else
66 msg_not_running Postfix
67 fi
68 ;;
69 restart)
70 $0 stop
71 $0 start
72 exit $?
73 ;;
74 reload|force-reload)
75 if [ -f /var/lock/subsys/postfix ]; then
76 msg_reloading Postfix
77 daemon /usr/sbin/postfix reload
78 RETVAL=$?
79 [ $RETVAL -ne 0 ] && RETVAL=7
80 else
81 msg_not_running Postfix
82 exit 7
83 fi
84 ;;
85 status)
86 status master
87 exit $?
88 ;;
89 rebuilddb)
90 standard_db="access canonical relocated transport virtual"
91 extra_db=$(ls -1 /etc/mail/*.db 2> /dev/null | grep -v aliases.db | sed -e 's#.db$##')
92 for base in $standard_db $extra_db; do
93 I=$(basename "$base")
94 if [ -f /etc/mail/$I ]; then
95 /usr/sbin/postmap hash:/etc/mail/$I < /etc/mail/$I
96 fi
97 done
98 /usr/bin/newaliases
99 ;;
100 *)
101 msg_usage "$0 {start|stop|restart|reload|force-reload|rebuilddb|status}"
102 exit 3
103esac
104
105exit $RETVAL
This page took 0.049833 seconds and 4 git commands to generate.