2006-02-23 15:26:10 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# /etc/rc.d/dovecot: start/stop dovecot IMAP/POP3 daemon
|
|
|
|
#
|
|
|
|
|
2015-02-20 12:29:09 +01:00
|
|
|
SSD=/sbin/start-stop-daemon
|
|
|
|
PROG=/usr/sbin/dovecot
|
2022-02-12 19:08:58 +01:00
|
|
|
PID=/run/dovecot/master.pid
|
2019-03-10 13:53:24 +01:00
|
|
|
KEY=/etc/ssl/private/dovecot.pem
|
|
|
|
CRT=/etc/ssl/certs/dovecot.pem
|
2006-02-23 15:26:10 +00:00
|
|
|
|
|
|
|
case $1 in
|
|
|
|
start)
|
2015-02-20 12:29:09 +01:00
|
|
|
if [ ! -s $KEY -o ! -s $CRT ]; then
|
2006-02-25 15:42:56 +00:00
|
|
|
/usr/bin/mksslcert $KEY $CRT
|
2006-02-23 15:26:10 +00:00
|
|
|
fi
|
2022-02-12 19:08:58 +01:00
|
|
|
mkdir -p /run/dovecot
|
2015-02-20 12:29:09 +01:00
|
|
|
$SSD --start --pidfile $PID --exec $PROG
|
2006-02-23 15:26:10 +00:00
|
|
|
;;
|
|
|
|
stop)
|
2015-02-20 12:29:09 +01:00
|
|
|
$SSD --stop --retry 10 --pidfile $PID
|
2006-02-23 15:26:10 +00:00
|
|
|
;;
|
|
|
|
restart)
|
|
|
|
$0 stop
|
|
|
|
$0 start
|
|
|
|
;;
|
|
|
|
reload)
|
2015-02-20 12:29:09 +01:00
|
|
|
$SSD --stop --signal HUP --pidfile $PID
|
|
|
|
;;
|
|
|
|
status)
|
|
|
|
$SSD --status --pidfile $PID
|
|
|
|
case $? in
|
2015-05-16 14:56:18 +02:00
|
|
|
0) echo "$PROG is running with pid $(cat $PID)" ;;
|
2015-02-20 12:29:09 +01:00
|
|
|
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
|
2006-02-23 15:26:10 +00:00
|
|
|
;;
|
|
|
|
*)
|
2015-02-20 12:29:09 +01:00
|
|
|
echo "usage: $0 [start|stop|restart|reload|status]"
|
2006-02-23 15:26:10 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# End of file
|