dovecot: improved rc script
This commit is contained in:
parent
d246f2fd77
commit
85d0693047
@ -1,3 +1,3 @@
|
||||
7eaa958040fbd7169c86134439d4b632 dovecot
|
||||
b0182b38cbfbfac34768eef9acd308f1 dovecot
|
||||
c6c176943bd832c780fbb5d2f8850952 dovecot-2.2.15.tar.gz
|
||||
346f4af957cd9fabaee1bc3c729f300f dovecot-config.patch
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
name=dovecot
|
||||
version=2.2.15
|
||||
release=1
|
||||
release=2
|
||||
source=(http://dovecot.org/releases/2.2/$name-$version.tar.gz \
|
||||
dovecot-config.patch dovecot)
|
||||
|
||||
|
@ -3,29 +3,41 @@
|
||||
# /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
|
||||
CRT=/etc/ssl/certs/dovecot.crt
|
||||
|
||||
case $1 in
|
||||
start)
|
||||
if [ ! -s $KEY -o ! -s $CRT ]; then
|
||||
if [ ! -s $KEY -o ! -s $CRT ]; then
|
||||
/usr/bin/mksslcert $KEY $CRT
|
||||
fi
|
||||
/usr/sbin/dovecot
|
||||
|
||||
$SSD --start --pidfile $PID --exec $PROG
|
||||
;;
|
||||
stop)
|
||||
killall -q /usr/sbin/dovecot
|
||||
$SSD --stop --retry 10 --pidfile $PID
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
sleep 2
|
||||
$0 start
|
||||
;;
|
||||
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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user