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=$(nice -n ${SERVICE_RUN_NICE_LEVEL:-${DEFAULT_SERVICE_RUN_NICE_LEVEL:-0}} /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 if [ $RETVAL -eq 0 ]; then
86 msg_not_running "Postfix"
92 # See how we were called.
111 standard_db="access canonical relocated transport virtual"
112 extra_db=$(ls -1 /etc/mail/*.db 2> /dev/null | egrep -v '/(access|canonical|relocated|transport|virtual|aliases)\.db$')
114 echo -n "Rebuilding databases: "
115 for base in $standard_db $extra_db; do
116 db=$(basename "$base" .db)
118 if [ -f /etc/mail/$db ]; then
120 /usr/sbin/postmap hash:/etc/mail/$db < /etc/mail/$db
125 echo -n "Rebuilding aliases database"
134 msg_usage "$0 {start|stop|restart|reload|force-reload|rebuilddb|status}"