contrib/mailman/mailman.service

44 lines
906 B
Desktop File
Executable File

#!/bin/sh
#
# /etc/rc.d/mailman: start/stop mailman daemon
#
SSD=/sbin/start-stop-daemon
PROG=/usr/bin/mailman
PID=/run/mailman/master.pid
USER=mailman
case $1 in
start)
if [ ! -e /run/mailman ]; then
mkdir -p /run/mailman
fi
$SSD --start -c $USER --pidfile $PID --exec $PROG -- start
;;
stop)
$SSD --start -c $USER --pidfile $PID --exec $PROG -- stop
$SSD --stop -c $USER --retry 10 --pidfile $PID
;;
restart)
$0 stop
$0 start
;;
reload)
$SSD --start -c $USER --pidfile $PID --exec $PROG -- restart
;;
status)
$SSD --status -u $USER -c $USER --pidfile $PID
case $? in
0) echo "$PROG is running with pid $(cat $PID)" ;;
1) echo "$PROG is not running but the pid file $PID exists" ;;
3) echo "$PROG is not running" ;;
4) echo "Unable to determine the program status" ;;
esac
;;
*)
echo "usage: $0 [start|stop|restart|reload|status]"
;;
esac
# End of file