opt/postfix/postfix.rc
2006-02-23 15:26:10 +00:00

53 lines
2.0 KiB
Bash

#!/bin/sh
######################################################################
# postfix: starts/stops postfix daemon
# description: Postfix is a Mail Transport Agent, which is the program
# that moves mail from one machine to another.
######################################################################
daemon="/usr/sbin/postfix"
config="/etc/postfix"
######################################################################
# Sanity Check
######################################################################
[ -x $daemon ] || exit 1
######################################################################
# Uncomment these if you want to rebuild aliases on restart
######################################################################
#/usr/sbin/postalias hash:$config/aliases
#/usr/sbin/postmap hash:$config/{access,canonical,relocated,transport,virtual}
#/usr/sbin/postmap hash:$config/access.{client,helo,sender,recpnt}
######################################################################
# Start/Stop/Reload/Status Functions
######################################################################
status() {
base=${daemon##*/}
dpid=`pidof -o $$ -o $PPID -o %PPID -x ${base}`
if [ "$dpid" != "" ]; then
echo "${base} (pid $dpid) is running..."
elif [ -s /var/run/${base}.pid ]; then
echo "${base} is dead but pid file exists..."
else
echo "${base} is stopped."
fi
return
}
######################################################################
# See how we were called
######################################################################
case "$1" in
start) $daemon start ;;
stop) $daemon stop ;;
reload) $daemon reload ;;
restart) $daemon reload ;;
status) status ;;
abort) $daemon abort ;;
flush) $daemon flush ;;
check) $daemon check ;;
*) echo "Usage: $0 {start|stop|reload|restart|status|abort|flush|check}" ; exit 1 ;;
esac
exit $?