You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

57 lines
1.7 KiB

#!@l_prefix@/bin/openpkg rc
##
## rc.asterisk -- Run-Commands
##
%config
asterisk_enable="$openpkg_rc_def"
asterisk_nice="-5"
asterisk_flags=""
asterisk_log_prolog="true"
asterisk_log_epilog="true"
asterisk_log_numfiles="10"
asterisk_log_minsize="1M"
asterisk_log_complevel="9"
%status -u @l_susr@ -o
asterisk_usable="unknown"
asterisk_active="no"
rcService asterisk enable yes && \
@l_prefix@/sbin/asterisk -rx "show version" >/dev/null 2>&1 && \
asterisk_active="yes"
echo "asterisk_enable=\"$asterisk_enable\""
echo "asterisk_usable=\"$asterisk_usable\""
echo "asterisk_active=\"$asterisk_active\""
%start -u @l_susr@
rcService asterisk enable yes || exit 0
rcService asterisk active yes && exit 0
nice -n $asterisk_nice @l_prefix@/sbin/asterisk ${asterisk_flags}
%stop -u @l_susr@
rcService asterisk enable yes || exit 0
rcService asterisk active no && exit 0
( @l_prefix@/sbin/asterisk -rx "stop gracefully" &
sleep 2
@l_prefix@/sbin/asterisk -rx "stop now" &
) >/dev/null 2>&1 || true
%restart -u @l_susr@
rcService asterisk enable yes || exit 0
rcService asterisk active no && exit 0
rc asterisk stop start
%reload -u @l_susr@
rcService asterisk enable yes || exit 0
rcService asterisk active no && exit 0
@l_prefix@/sbin/asterisk -rx "reload"
%daily -u @l_susr@
rcService asterisk enable yes || exit 0
shtool rotate -f \
-n ${asterisk_log_numfiles} -s ${asterisk_log_minsize} -d \
-z ${asterisk_log_complevel} -m 664 -o @l_rusr@ -g @l_rgrp@ \
-P "${asterisk_log_prolog}" \
-E "${asterisk_log_epilog}; rc asterisk reload" \
@l_prefix@/var/asterisk/log/asterisk.log