Mon, 27 Apr 2009 12:19:05 +0200
Import new package spec for introduction into repository.
michael@202 | 1 | #!@l_prefix@/bin/openpkg rc |
michael@202 | 2 | ## |
michael@202 | 3 | ## rc.asterisk -- Run-Commands |
michael@202 | 4 | ## |
michael@202 | 5 | |
michael@202 | 6 | %config |
michael@202 | 7 | asterisk_enable="$openpkg_rc_def" |
michael@202 | 8 | asterisk_flags="" |
michael@202 | 9 | asterisk_log_prolog="true" |
michael@202 | 10 | asterisk_log_epilog="true" |
michael@202 | 11 | asterisk_log_numfiles="10" |
michael@202 | 12 | asterisk_log_minsize="1M" |
michael@202 | 13 | asterisk_log_complevel="9" |
michael@202 | 14 | |
michael@202 | 15 | %status -u @l_susr@ -o |
michael@202 | 16 | asterisk_usable="unknown" |
michael@202 | 17 | asterisk_active="no" |
michael@202 | 18 | rcService asterisk enable yes && \ |
michael@202 | 19 | @l_prefix@/sbin/asterisk -rx "show version" >/dev/null 2>&1 && \ |
michael@202 | 20 | asterisk_active="yes" |
michael@202 | 21 | echo "asterisk_enable=\"$asterisk_enable\"" |
michael@202 | 22 | echo "asterisk_usable=\"$asterisk_usable\"" |
michael@202 | 23 | echo "asterisk_active=\"$asterisk_active\"" |
michael@202 | 24 | |
michael@202 | 25 | %start -u @l_susr@ |
michael@202 | 26 | rcService asterisk enable yes || exit 0 |
michael@202 | 27 | rcService asterisk active yes && exit 0 |
michael@202 | 28 | @l_prefix@/sbin/asterisk ${asterisk_flags} |
michael@202 | 29 | |
michael@202 | 30 | %stop -u @l_susr@ |
michael@202 | 31 | rcService asterisk enable yes || exit 0 |
michael@202 | 32 | rcService asterisk active no && exit 0 |
michael@202 | 33 | ( @l_prefix@/sbin/asterisk -rx "stop gracefully" & |
michael@202 | 34 | sleep 2 |
michael@202 | 35 | @l_prefix@/sbin/asterisk -rx "stop now" & |
michael@202 | 36 | ) >/dev/null 2>&1 || true |
michael@202 | 37 | |
michael@202 | 38 | %restart -u @l_susr@ |
michael@202 | 39 | rcService asterisk enable yes || exit 0 |
michael@202 | 40 | rcService asterisk active no && exit 0 |
michael@202 | 41 | rc asterisk stop start |
michael@202 | 42 | |
michael@202 | 43 | %reload -u @l_susr@ |
michael@202 | 44 | rcService asterisk enable yes || exit 0 |
michael@202 | 45 | rcService asterisk active no && exit 0 |
michael@202 | 46 | @l_prefix@/sbin/asterisk -rx "reload" |
michael@202 | 47 | |
michael@202 | 48 | %daily -u @l_susr@ |
michael@202 | 49 | rcService asterisk enable yes || exit 0 |
michael@202 | 50 | shtool rotate -f \ |
michael@202 | 51 | -n ${asterisk_log_numfiles} -s ${asterisk_log_minsize} -d \ |
michael@202 | 52 | -z ${asterisk_log_complevel} -m 664 -o @l_rusr@ -g @l_rgrp@ \ |
michael@202 | 53 | -P "${asterisk_log_prolog}" \ |
michael@202 | 54 | -E "${asterisk_log_epilog}; rc asterisk reload" \ |
michael@202 | 55 | @l_prefix@/var/asterisk/log/asterisk.log |
michael@202 | 56 |