1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/asterisk/rc.asterisk Mon Apr 27 12:19:05 2009 +0200 1.3 @@ -0,0 +1,56 @@ 1.4 +#!@l_prefix@/bin/openpkg rc 1.5 +## 1.6 +## rc.asterisk -- Run-Commands 1.7 +## 1.8 + 1.9 +%config 1.10 + asterisk_enable="$openpkg_rc_def" 1.11 + asterisk_flags="" 1.12 + asterisk_log_prolog="true" 1.13 + asterisk_log_epilog="true" 1.14 + asterisk_log_numfiles="10" 1.15 + asterisk_log_minsize="1M" 1.16 + asterisk_log_complevel="9" 1.17 + 1.18 +%status -u @l_susr@ -o 1.19 + asterisk_usable="unknown" 1.20 + asterisk_active="no" 1.21 + rcService asterisk enable yes && \ 1.22 + @l_prefix@/sbin/asterisk -rx "show version" >/dev/null 2>&1 && \ 1.23 + asterisk_active="yes" 1.24 + echo "asterisk_enable=\"$asterisk_enable\"" 1.25 + echo "asterisk_usable=\"$asterisk_usable\"" 1.26 + echo "asterisk_active=\"$asterisk_active\"" 1.27 + 1.28 +%start -u @l_susr@ 1.29 + rcService asterisk enable yes || exit 0 1.30 + rcService asterisk active yes && exit 0 1.31 + @l_prefix@/sbin/asterisk ${asterisk_flags} 1.32 + 1.33 +%stop -u @l_susr@ 1.34 + rcService asterisk enable yes || exit 0 1.35 + rcService asterisk active no && exit 0 1.36 + ( @l_prefix@/sbin/asterisk -rx "stop gracefully" & 1.37 + sleep 2 1.38 + @l_prefix@/sbin/asterisk -rx "stop now" & 1.39 + ) >/dev/null 2>&1 || true 1.40 + 1.41 +%restart -u @l_susr@ 1.42 + rcService asterisk enable yes || exit 0 1.43 + rcService asterisk active no && exit 0 1.44 + rc asterisk stop start 1.45 + 1.46 +%reload -u @l_susr@ 1.47 + rcService asterisk enable yes || exit 0 1.48 + rcService asterisk active no && exit 0 1.49 + @l_prefix@/sbin/asterisk -rx "reload" 1.50 + 1.51 +%daily -u @l_susr@ 1.52 + rcService asterisk enable yes || exit 0 1.53 + shtool rotate -f \ 1.54 + -n ${asterisk_log_numfiles} -s ${asterisk_log_minsize} -d \ 1.55 + -z ${asterisk_log_complevel} -m 664 -o @l_rusr@ -g @l_rgrp@ \ 1.56 + -P "${asterisk_log_prolog}" \ 1.57 + -E "${asterisk_log_epilog}; rc asterisk reload" \ 1.58 + @l_prefix@/var/asterisk/log/asterisk.log 1.59 +