101 lines
1.4 KiB
Bash
101 lines
1.4 KiB
Bash
#!/bin/bash
|
|
#
|
|
# /etc/rc.d/init.d/postfix
|
|
#
|
|
# Copyright (c) 2007 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
|
#
|
|
# Start/stop the postscript mail daemon
|
|
#
|
|
# chkconfig: 345 30 60
|
|
# description: The postfix mail daemon
|
|
# processname: postfix
|
|
|
|
# Source function library.
|
|
. /etc/rc.d/init.d/functions
|
|
|
|
PROGNAME=postfix
|
|
test -x /usr/sbin/$PROGNAME || exit 0
|
|
|
|
RETVAL=0
|
|
|
|
#
|
|
# See how we were called.
|
|
#
|
|
|
|
start() {
|
|
echo -n "Starting $PROGNAME: "
|
|
/usr/sbin/$PROGNAME start
|
|
RETVAL=$?
|
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$PROGNAME
|
|
evaluate_retval
|
|
echo
|
|
return $RETVAL
|
|
}
|
|
|
|
stop() {
|
|
if [[ -f /var/lock/subsys/$PROGNAME ]]; then
|
|
echo -n "Stopping $PROGNAME: "
|
|
/usr/sbin/$PROGNAME stop
|
|
RETVAL=$?
|
|
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$PROGNAME
|
|
evaluate_retval
|
|
echo
|
|
return $RETVAL
|
|
fi
|
|
}
|
|
|
|
reload() {
|
|
/usr/sbin/$PROGNAME reload
|
|
}
|
|
|
|
flush() {
|
|
/usr/sbin/$PROGNAME flush
|
|
}
|
|
|
|
check() {
|
|
/usr/sbin/$PROGNAME check
|
|
}
|
|
|
|
abort() {
|
|
/usr/sbin/$PROGNAME abort
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
start
|
|
;;
|
|
stop)
|
|
stop
|
|
;;
|
|
restart)
|
|
stop
|
|
start
|
|
;;
|
|
reload)
|
|
reload
|
|
;;
|
|
abort)
|
|
abort
|
|
;;
|
|
flush)
|
|
flush
|
|
;;
|
|
check)
|
|
check
|
|
;;
|
|
condrestart)
|
|
if [ -f /var/lock/subsys/$PROGNAME ]; then
|
|
restart
|
|
fi
|
|
;;
|
|
status)
|
|
status $PROGNAME
|
|
;;
|
|
*)
|
|
INITNAME=`basename $0`
|
|
echo "Usage: $INITNAME {start|stop|restart|reload|condrestart|abort|flush|check|status}"
|
|
exit 1
|
|
esac
|
|
|
|
exit $RETVAL
|