Wed, 08 Feb 2012 20:07:00 +0200
Update version, adapt patch, correct PID writing, correct build on newer
FreeBSD releases, and most importantly introduce new patch to try to
avoid segfault caused by multiple network interfaces with the same (or
no) address. This is common when configuring bridges and tunnels.
michael@148 | 1 | #!@l_prefix@/bin/openpkg rc |
michael@148 | 2 | ## |
michael@148 | 3 | ## rc.dovecot -- Run-Commands |
michael@148 | 4 | ## |
michael@148 | 5 | |
michael@148 | 6 | %config |
michael@148 | 7 | dovecot_enable="$openpkg_rc_def" |
michael@148 | 8 | dovecot_log_prolog="true" |
michael@148 | 9 | dovecot_log_epilog="true" |
michael@148 | 10 | dovecot_log_numfiles="10" |
michael@148 | 11 | dovecot_log_minsize="1M" |
michael@148 | 12 | dovecot_log_complevel="9" |
michael@148 | 13 | dovecot_deliver_log_prolog="true" |
michael@148 | 14 | dovecot_deliver_log_epilog="true" |
michael@148 | 15 | dovecot_deliver_log_numfiles="10" |
michael@148 | 16 | dovecot_deliver_log_minsize="1M" |
michael@148 | 17 | dovecot_deliver_log_complevel="9" |
michael@148 | 18 | |
michael@148 | 19 | %common |
michael@148 | 20 | dovecot_pidfile="@l_prefix@/var/dovecot/run/master.pid" |
michael@148 | 21 | dovecot_signal () { |
michael@148 | 22 | [ -f $dovecot_pidfile ] && kill -$1 `cat $dovecot_pidfile` |
michael@148 | 23 | } |
michael@148 | 24 | |
michael@148 | 25 | %status -u @l_susr@ -o |
michael@148 | 26 | dovecot_usable="unknown" |
michael@148 | 27 | dovecot_active="no" |
michael@148 | 28 | rcService dovecot enable yes && \ |
michael@148 | 29 | dovecot_signal 0 && dovecot_active="yes" |
michael@148 | 30 | echo "dovecot_enable=\"$dovecot_enable\"" |
michael@148 | 31 | echo "dovecot_usable=\"$dovecot_usable\"" |
michael@148 | 32 | echo "dovecot_active=\"$dovecot_active\"" |
michael@148 | 33 | |
michael@148 | 34 | %start -u @l_susr@ |
michael@148 | 35 | rcService dovecot enable yes || exit 0 |
michael@148 | 36 | rcService dovecot active yes && exit 0 |
michael@148 | 37 | @l_prefix@/sbin/dovecot |
michael@148 | 38 | |
michael@148 | 39 | %stop -u @l_susr@ |
michael@148 | 40 | rcService dovecot enable yes || exit 0 |
michael@148 | 41 | rcService dovecot active no && exit 0 |
michael@148 | 42 | dovecot_signal TERM |
michael@148 | 43 | sleep 2 |
michael@148 | 44 | rm -f $dovecot_pidfile >/dev/null 2>&1 || true |
michael@148 | 45 | |
michael@148 | 46 | %restart -u @l_susr@ |
michael@148 | 47 | rcService dovecot enable yes || exit 0 |
michael@148 | 48 | rcService dovecot active no && exit 0 |
michael@148 | 49 | rc dovecot stop start |
michael@148 | 50 | |
michael@148 | 51 | %reload -u @l_susr@ |
michael@148 | 52 | rcService dovecot enable yes || exit 0 |
michael@148 | 53 | rcService dovecot active no && exit 0 |
michael@148 | 54 | dovecot_signal HUP |
michael@148 | 55 | |
michael@148 | 56 | %daily -u @l_susr@ |
michael@148 | 57 | rcService dovecot enable yes || exit 0 |
michael@148 | 58 | rcTmp -i |
michael@148 | 59 | hintfile=`rcTmp -f -n hint` |
michael@148 | 60 | shtool rotate -f \ |
michael@148 | 61 | -n ${dovecot_log_numfiles} -s ${dovecot_log_minsize} -d \ |
michael@148 | 62 | -z ${dovecot_log_complevel} -m 600 -o @l_susr@ -g @l_sgrp@ \ |
michael@148 | 63 | -P "${dovecot_log_prolog}" \ |
michael@148 | 64 | -E "${dovecot_log_epilog}; echo 1 >$hintfile" \ |
michael@148 | 65 | @l_prefix@/var/dovecot/log/dovecot.log |
michael@148 | 66 | if [ -s $hintfile ]; then |
michael@148 | 67 | dovecot_signal USR1 |
michael@148 | 68 | fi |
michael@148 | 69 | rcTmp -k |
michael@148 | 70 | shtool rotate -f \ |
michael@148 | 71 | -n ${dovecot_deliver_log_numfiles} -s ${dovecot_deliver_log_minsize} -d \ |
michael@148 | 72 | -z ${dovecot_deliver_log_complevel} -m 600 -o @l_rusr@ -g @l_rgrp@ \ |
michael@148 | 73 | -P "${dovecot_deliver_log_prolog}" \ |
michael@148 | 74 | -E "${dovecot_deliver_log_epilog}" \ |
michael@148 | 75 | @l_prefix@/var/dovecot/log/deliver.log |
michael@148 | 76 |