blob: d81d6cf73a3d59cb5e968dfab28b232d10afb9d2 (
plain)
1 #!/bin/sh
2 #
3 # /etc/rc.d/dovecot: start/stop dovecot IMAP/POP3 daemon
4 #
5
6 SSD=/sbin/start-stop-daemon
7 PROG=/usr/sbin/dovecot
8 PID=/run/dovecot/master.pid
9 KEY=/etc/ssl/private/dovecot.pem
10 CRT=/etc/ssl/certs/dovecot.pem
11
12 case $1 in
13 start)
14 if [ ! -s $KEY -o ! -s $CRT ]; then
15 /usr/bin/mksslcert $KEY $CRT
16 fi
17 mkdir -p /run/dovecot
18 $SSD --start --pidfile $PID --exec $PROG
19 ;;
20 stop)
21 $SSD --stop --retry 10 --pidfile $PID
22 ;;
23 restart)
24 $0 stop
25 $0 start
26 ;;
27 reload)
28 $SSD --stop --signal HUP --pidfile $PID
29 ;;
30 status)
31 $SSD --status --pidfile $PID
32 case $? in
33 0) echo "$PROG is running with pid $(cat $PID)" ;;
34 1) echo "$PROG is not running but the pid file $PID exists" ;;
35 3) echo "$PROG is not running" ;;
36 4) echo "Unable to determine the program status" ;;
37 esac
38 ;;
39 *)
40 echo "usage: $0 [start|stop|restart|reload|status]"
41 ;;
42 esac
43
44 # End of file
|