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"
34 if [ -f /var/lock/subsys/postfix ]; then
35 msg_already_running "Postfix"
40 msg_starting "Postfix"
43 msg=$(nice -n ${SERVICE_RUN_NICE_LEVEL:-${DEFAULT_SERVICE_RUN_NICE_LEVEL:-0}} /usr/sbin/postfix start 2>&1)
45 if [ $RETVAL -eq 0 ]; then
47 touch /var/lock/subsys/postfix
55 if [ ! -f /var/lock/subsys/postfix ]; then
56 msg_not_running "Postfix"
61 msg_stopping "Postfix"
63 msg=$(/usr/sbin/postfix stop 2>&1)
70 rm -f /var/lock/subsys/postfix >/dev/null 2>&1
74 if [ ! -f /var/lock/subsys/postfix ]; then
75 msg_not_running "Postfix"
81 msg_reloading "Postfix"
83 msg=$(/usr/sbin/postfix reload 2>&1)
85 if [ $RETVAL -eq 0 ]; then
95 # See how we were called.
114 standard_db="access canonical relocated transport virtual"
115 extra_db=$(ls -1 /etc/mail/*.db 2> /dev/null | grep -Ev '/(access|canonical|relocated|transport|virtual|aliases)\.db$')
117 echo -n "Rebuilding databases: "
118 for base in $standard_db $extra_db; do
119 db=$(basename "$base" .db)
121 if [ -f /etc/mail/$db ]; then
123 /usr/sbin/postmap hash:/etc/mail/$db < /etc/mail/$db
128 echo -n "Rebuilding aliases database"
137 msg_usage "$0 {start|stop|restart|reload|force-reload|rebuilddb|status}"