3 # postfix This shell script takes care of starting and stopping
8 # description: Postfix is a Mail Transport Agent, which is the program \
9 # that moves mail from one machine to another.
12 # Source function library
13 . /etc/rc.d/init.d/functions
16 . /etc/sysconfig/network
19 [ -f /etc/sysconfig/postfix ] && . /etc/sysconfig/postfix
21 # Check that networking is up.
23 if is_yes "${NETWORKING}"; then
24 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
25 msg_network_down "Postfix"
36 if [ ! -f /var/lock/subsys/postfix ]; then
37 msg_starting "Postfix"
39 msg=$(/usr/sbin/postfix start 2>&1)
41 if [ $RETVAL -eq 0 ]; then
43 touch /var/lock/subsys/postfix
49 msg_already_running "Postfix"
55 if [ -f /var/lock/subsys/postfix ]; then
56 msg_stopping "Postfix"
58 msg=$(/usr/sbin/postfix stop 2>&1)
65 rm -f /var/lock/subsys/postfix
67 msg_not_running "Postfix"
73 if [ -f /var/lock/subsys/postfix ]; then
74 msg_reloading "Postfix"
76 msg=$(/usr/sbin/postfix reload 2>&1)
78 [ $RETVAL -ne 0 ] && RETVAL=7
80 msg_not_running "Postfix"
86 # See how we were called.
105 standard_db="access canonical relocated transport virtual"
106 extra_db=$(ls -1 /etc/mail/*.db 2> /dev/null | egrep -v '/(access|canonical|relocated|transport|virtual|aliases)\.db$')
108 echo -n "Rebuilding databases: "
109 for base in $standard_db $extra_db; do
110 db=$(basename "$base" .db)
112 if [ -f /etc/mail/$db ]; then
114 /usr/sbin/postmap hash:/etc/mail/$db < /etc/mail/$db
119 echo -n "Rebuilding aliases database"
128 msg_usage "$0 {start|stop|restart|reload|force-reload|rebuilddb|status}"