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