contrib/mailman/mailman.service

44 lines
906 B
SYSTEMD
Raw Normal View History

2024-02-24 21:27:24 +01:00
#!/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
2024-02-24 21:27:24 +01:00
case $1 in
start)
if [ ! -e /run/mailman ]; then
mkdir -p /run/mailman
fi
$SSD --start -c $USER --pidfile $PID --exec $PROG -- start
2024-02-24 21:27:24 +01:00
;;
stop)
$SSD --start -c $USER --pidfile $PID --exec $PROG -- stop
$SSD --stop -c $USER --retry 10 --pidfile $PID
2024-02-24 21:27:24 +01:00
;;
restart)
$0 stop
$0 start
;;
reload)
$SSD --start -c $USER --pidfile $PID --exec $PROG -- restart
2024-02-24 21:27:24 +01:00
;;
status)
$SSD --status -u $USER -c $USER --pidfile $PID
2024-02-24 21:27:24 +01:00
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