dovecot: improved rc script

This commit is contained in:
Juergen Daubert 2015-02-20 12:29:09 +01:00
parent d246f2fd77
commit 85d0693047
3 changed files with 20 additions and 8 deletions

View File

@ -1,3 +1,3 @@
7eaa958040fbd7169c86134439d4b632 dovecot b0182b38cbfbfac34768eef9acd308f1 dovecot
c6c176943bd832c780fbb5d2f8850952 dovecot-2.2.15.tar.gz c6c176943bd832c780fbb5d2f8850952 dovecot-2.2.15.tar.gz
346f4af957cd9fabaee1bc3c729f300f dovecot-config.patch 346f4af957cd9fabaee1bc3c729f300f dovecot-config.patch

View File

@ -5,7 +5,7 @@
name=dovecot name=dovecot
version=2.2.15 version=2.2.15
release=1 release=2
source=(http://dovecot.org/releases/2.2/$name-$version.tar.gz \ source=(http://dovecot.org/releases/2.2/$name-$version.tar.gz \
dovecot-config.patch dovecot) dovecot-config.patch dovecot)

View File

@ -3,29 +3,41 @@
# /etc/rc.d/dovecot: start/stop dovecot IMAP/POP3 daemon # /etc/rc.d/dovecot: start/stop dovecot IMAP/POP3 daemon
# #
SSD=/sbin/start-stop-daemon
PROG=/usr/sbin/dovecot
PID=/var/run/dovecot/master.pid
KEY=/etc/ssl/keys/dovecot.key KEY=/etc/ssl/keys/dovecot.key
CRT=/etc/ssl/certs/dovecot.crt CRT=/etc/ssl/certs/dovecot.crt
case $1 in case $1 in
start) start)
if [ ! -s $KEY -o ! -s $CRT ]; then if [ ! -s $KEY -o ! -s $CRT ]; then
/usr/bin/mksslcert $KEY $CRT /usr/bin/mksslcert $KEY $CRT
fi fi
/usr/sbin/dovecot
$SSD --start --pidfile $PID --exec $PROG
;; ;;
stop) stop)
killall -q /usr/sbin/dovecot $SSD --stop --retry 10 --pidfile $PID
;; ;;
restart) restart)
$0 stop $0 stop
sleep 2
$0 start $0 start
;; ;;
reload) reload)
kill -s HUP $(pidof dovecot) $SSD --stop --signal HUP --pidfile $PID
;;
status)
$SSD --status --pidfile $PID
case $? in
0) echo "$PROG is running" ;;
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]" echo "usage: $0 [start|stop|restart|reload|status]"
;; ;;
esac esac