1 |
commit: 3936bafb10bd149224096c2600b6253424851486 |
2 |
Author: Michael Mair-Keimberger <mmk <AT> levelnine <DOT> at> |
3 |
AuthorDate: Wed Aug 24 17:38:55 2022 +0000 |
4 |
Commit: John Helmert III <ajak <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Aug 24 21:11:14 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3936bafb |
7 |
|
8 |
net-misc/asterisk: remove unused files |
9 |
|
10 |
Signed-off-by: Michael Mair-Keimberger <mmk <AT> levelnine.at> |
11 |
Portage 3.0.34 / pkgdev 0.2.1 / pkgcheck 0.10.14 |
12 |
Closes: https://github.com/gentoo/gentoo/pull/27004 |
13 |
Signed-off-by: John Helmert III <ajak <AT> gentoo.org> |
14 |
|
15 |
net-misc/asterisk/files/confd-16.16.2-r1 | 171 ------------- |
16 |
net-misc/asterisk/files/initd-16.22.0-18.8.0 | 363 --------------------------- |
17 |
2 files changed, 534 deletions(-) |
18 |
|
19 |
diff --git a/net-misc/asterisk/files/confd-16.16.2-r1 b/net-misc/asterisk/files/confd-16.16.2-r1 |
20 |
deleted file mode 100644 |
21 |
index a2da978af924..000000000000 |
22 |
--- a/net-misc/asterisk/files/confd-16.16.2-r1 |
23 |
+++ /dev/null |
24 |
@@ -1,171 +0,0 @@ |
25 |
-# Copyright 1999-2020 Gentoo Authors |
26 |
-# Distributed under the terms of the GNU General Public License v2 |
27 |
- |
28 |
-# |
29 |
-# Additional options for asterisk |
30 |
-# |
31 |
-# see "asterisk -h" for a list of options |
32 |
-# |
33 |
-# No default. |
34 |
-# |
35 |
-#ASTERISK_OPTS="" |
36 |
- |
37 |
-# |
38 |
-# User and group to run asterisk as |
39 |
-# |
40 |
-# Value: double-colon separated list of user and group, or empty to run as root: |
41 |
-# |
42 |
-# |
43 |
-# "asterisk:asterisk" to run as user "asterisk" and group "asterisk" |
44 |
-# "asterisk" to run as user "asterisk" and all groups that user "asterisk" is a member of |
45 |
-# ":asterisk" to run as user "root" and group "asterisk" |
46 |
-# |
47 |
-# Default: asterisk |
48 |
-# |
49 |
-#ASTERISK_USER="asterisk" |
50 |
- |
51 |
-# |
52 |
-# Nicelevel |
53 |
-# |
54 |
-# Set the priority of the asterisk process |
55 |
-# |
56 |
-# Value: (highest) -20..19 (lowest) |
57 |
-# |
58 |
-# No default (leave scheduling to be system default). |
59 |
-# |
60 |
-#ASTERISK_NICE="19" |
61 |
- |
62 |
-# Send crash notifications emails to this address |
63 |
-# (needs a working mail service and /usr/sbin/sendmail to do so (e.g. ssmtp)) |
64 |
-# |
65 |
-# Value: Email address or empty to disable |
66 |
-# |
67 |
-# No default. |
68 |
-# |
69 |
-#ASTERISK_NOTIFY_EMAIL="root" |
70 |
- |
71 |
-# |
72 |
-# Send asterisk's output to this terminal |
73 |
-# |
74 |
-# Value: Full path to device node or a number |
75 |
-# |
76 |
-# No default. |
77 |
-# |
78 |
-#ASTERISK_TTY="/dev/tty9" |
79 |
- |
80 |
-# |
81 |
-# Start an asterisk console on the terminal specified by ASTERISK_TTY |
82 |
-# |
83 |
-# Warning! Use only for debugging, this is a potential security issue! |
84 |
-# |
85 |
-# Value: yes/no |
86 |
-# |
87 |
-# Default: no |
88 |
-# |
89 |
-#ASTERISK_CONSOLE="no" |
90 |
- |
91 |
-# |
92 |
-# Maximum size of core files. |
93 |
-# |
94 |
-# Value: Size in bytes, unlimited for no limit or empty to disable. |
95 |
-# |
96 |
-# Default: do not generate core dumps |
97 |
-# |
98 |
-#ASTERISK_CORE_SIZE="unlimited" |
99 |
- |
100 |
-# |
101 |
-# ASTERISK_CORE_DIR |
102 |
-# |
103 |
-# Value: Directory (will be created if non-existant). |
104 |
-# |
105 |
-# Default: /tmp |
106 |
-# |
107 |
-#ASTERISK_CORE_DIR="/var/lib/asterisk/core" |
108 |
- |
109 |
-# |
110 |
-# Max number of filedescriptors. asterisk can trivially run out of |
111 |
-# descriptors. In most (SIP) cases it uses at least four descriptors per call, |
112 |
-# and this is a conservative value. |
113 |
-# |
114 |
-# Value: Number of descriptors |
115 |
-# |
116 |
-# Default: leave system default in place. |
117 |
-# |
118 |
-ASTERISK_MAX_FD="4096" |
119 |
- |
120 |
-# |
121 |
-# Delay time before restarting asterisk after a crash. |
122 |
-# |
123 |
-# Value: Number of seconds to sleep after a crash before restarting. |
124 |
-# |
125 |
-# Default: 5 |
126 |
-# |
127 |
-#ASTERISK_RESTART_DELAY=5 |
128 |
- |
129 |
-# |
130 |
-# The stop mechanism to use. Asterisk can do gracefully, when convenient or now. |
131 |
-# By default we expect you to want to stop as soon as possible, so we default |
132 |
-# |
133 |
-# Default: gracefully |
134 |
-# |
135 |
-#ASTERISK_STOP_METHOD="when convenient" |
136 |
- |
137 |
-# |
138 |
-# By default the init script waits two minutes for asterisk to stop. This allows |
139 |
-# you to change that, or even completely disable and go into wait for ever mode (-1). |
140 |
-# The value here is in seconds. |
141 |
-# |
142 |
-# Default: 120 |
143 |
-# |
144 |
-#ASTERISK_STOP_TIMEOUT=-1 |
145 |
- |
146 |
-# |
147 |
-# Kill these tasks after asterisk crashed |
148 |
-# |
149 |
-# Warning! This will kill _ALL_ tasks with the specified names! |
150 |
-# |
151 |
-# Value: Space separated list of names in double quotes (e.g. "mpg123 mad") |
152 |
-# |
153 |
-# Default is to not do stupid things like killing random processes. |
154 |
-# |
155 |
-#ASTERISK_CLEANUP_ON_CRASH="mpg123 asterisk-mpg123 mad" |
156 |
- |
157 |
-# |
158 |
-# ASTERISK_CONFDIR |
159 |
-# |
160 |
-# If you'd like an alternative folder to /etc/${RC_SVCNAME} to be used |
161 |
-# (typically /etc/asterisk) to be used for configuration. |
162 |
-# |
163 |
-# Default: /etc/${RC_SVCNAME} |
164 |
-# |
165 |
-#ASTERISK_CONFDIR="/etc/foo/bar" |
166 |
- |
167 |
-# ASTERISK_CACHEDIR |
168 |
-# |
169 |
-# Value: Directory to which astcachedir in asterisk.conf is set. |
170 |
-# |
171 |
-# Default: /var/cache/asterisk |
172 |
-# |
173 |
-#ASTERISK_CACHEDIR="/var/cache/asterisk" |
174 |
- |
175 |
- |
176 |
-# |
177 |
-# Normally the init script will not wait for asterisk to fully boot. With this |
178 |
-# setting set to yes/true/1 it will issue a "core waitfullybooted" directly |
179 |
-# after starting asterisk, and wait for asterisk to start up completely. This |
180 |
-# is useful in certain conditions where other software requires asterisk to be |
181 |
-# properly started before they themselves can be started. |
182 |
-# |
183 |
-# Default: no |
184 |
-# |
185 |
-#ASTERISK_WAITBOOTED=yes |
186 |
- |
187 |
-# |
188 |
-# When core-dumping, the default was to generate core-$(date +%Y%m%d-%H%M%S). |
189 |
-# In certain highly unusual configurations it's helpful to also get the |
190 |
-# hostname into this filename. By enabling this option the wrapper loop will |
191 |
-# adjust the core file to be named core-$(hostname)-$(date ...). |
192 |
-# |
193 |
-# Default: no |
194 |
-# |
195 |
-#ASTERISK_CORE_USEHOSTNAME=yes |
196 |
|
197 |
diff --git a/net-misc/asterisk/files/initd-16.22.0-18.8.0 b/net-misc/asterisk/files/initd-16.22.0-18.8.0 |
198 |
deleted file mode 100644 |
199 |
index ed6fa8bca742..000000000000 |
200 |
--- a/net-misc/asterisk/files/initd-16.22.0-18.8.0 |
201 |
+++ /dev/null |
202 |
@@ -1,363 +0,0 @@ |
203 |
-#!/sbin/openrc-run |
204 |
-# Copyright 1999-2021 Gentoo Authors |
205 |
-# Distributed under the terms of the GNU General Public License v2 |
206 |
- |
207 |
-extra_started_commands="forcestop reload" |
208 |
- |
209 |
-depend() { |
210 |
- need net |
211 |
- use nscd dns dahdi mysql postgresql slapd capi |
212 |
-} |
213 |
- |
214 |
-is_running() { |
215 |
- [ -r "${ast_rundir}/asterisk.pid" ] || return 1 |
216 |
- PID="$(cat "${ast_rundir}/asterisk.pid")" |
217 |
- [ -d "/proc/${PID}" ] || return 1 |
218 |
- EXE="$(readlink -f /proc/${PID}/exe)" |
219 |
- EXE="${EXE% (deleted)}" # in case asterisk got upgraded and we're still looking at an old one. |
220 |
- [ "${EXE}" = /usr/sbin/asterisk ] || return 1 # pid got re-used for another process. |
221 |
- |
222 |
- # PID reported in pidfile is active, and is still an asterisk instance. |
223 |
- return 0 |
224 |
-} |
225 |
- |
226 |
-# Sets up a few variables for us for use |
227 |
-# ast_instancename: eg, asterisk when RC_SVCNAME=asterisk, or asterisk(foo) when asterisk.foo. |
228 |
-# ast_rundir: directory to be used as run folder (pid and ctl files). |
229 |
-setup_svc_variables() |
230 |
-{ |
231 |
- local t |
232 |
- |
233 |
- ast_instancename=asterisk |
234 |
- ast_rundir=/run/${RC_SVCNAME} |
235 |
- ast_logdir=/var/log/${RC_SVCNAME} |
236 |
- ast_confdir=/etc/${RC_SVCNAME/.//} |
237 |
- ast_cachedir=/var/cache/asterisk |
238 |
- ast_stop_timeout=120 |
239 |
- ast_stop_method="gracefully" |
240 |
- |
241 |
- if [ "${RC_SVCNAME}" != "asterisk" ]; then |
242 |
- t="${RC_SVCNAME#asterisk.}" |
243 |
- if [ "${RC_SVCNAME}" = "${t}" ]; then |
244 |
- eerror "Invalid SVCNAME of ${RC_SVCNAME}, must be of the format asterisk.name." |
245 |
- return 1 |
246 |
- fi |
247 |
- ast_instancename+="(${t})" |
248 |
- fi |
249 |
- |
250 |
- [ -n "${ASTERISK_RUNDIR}" ] && ast_rundir="${ASTERISK_RUNDIR}" |
251 |
- [ -n "${ASTERISK_LOGDIR}" ] && ast_logdir="${ASTERISK_LOGDIR}" |
252 |
- [ -n "${ASTERISK_CONFDIR}" ] && ast_confdir="${ASTERISK_CONFDIR}" |
253 |
- [ -n "${ASTERISK_CACHEDIR}" ] && ast_confdir="${ASTERISK_CACHEDIR}" |
254 |
- [ -n "${ASTERISK_STOP_TIMEOUT}" ] && ast_stop_timeout="${ASTERISK_STOP_TIMEOUT}" |
255 |
- case "${ASTERISK_STOP_METHOD}" in |
256 |
- gracefully|when\ convenient|now) |
257 |
- ast_stop_method="${ASTERISK_STOP_METHOD}" |
258 |
- ;; |
259 |
- esac |
260 |
- ast_group= |
261 |
- if [ -n "${ASTERISK_USER}" ]; then |
262 |
- ast_user="${ASTERISK_USER%%:*}" |
263 |
- if [ "${ast_user}" != "${ASTERISK_USER}" ]; then |
264 |
- ast_group="${ASTERISK_USER#*:}" |
265 |
- ast_group="${ast_group%%:*}" |
266 |
- fi |
267 |
- fi |
268 |
- |
269 |
- [ -z "${ast_user}" ] && ast_user=asterisk |
270 |
- |
271 |
- ast_pgroup="$(getent group $(getent passwd "${ast_user}" | awk -F: '{ print $4 }') | sed -re 's/:.*//')" |
272 |
- |
273 |
- return 0 |
274 |
-} |
275 |
- |
276 |
-asterisk_run_loop() { |
277 |
- local result=0 signal=0 |
278 |
- |
279 |
- echo "Initializing ${ast_instancename} wrapper" |
280 |
- OPTS="$*" |
281 |
- |
282 |
- trap "rm -f '${ast_rundir}/wrapper_loop.running'" EXIT |
283 |
- touch "${ast_rundir}/wrapper_loop.running" |
284 |
- |
285 |
- while [ -r "${ast_rundir}/wrapper_loop.running" ]; do |
286 |
- if [ -n "${TTY}" ]; then |
287 |
- /usr/bin/stty -F "${TTY}" sane |
288 |
- ${NICE} /usr/sbin/asterisk -C "${ast_confdir}/asterisk.conf" ${OPTS} >"${TTY}" 2>&1 <"${TTY}" |
289 |
- result=$? |
290 |
- else |
291 |
- ${NICE} /usr/sbin/asterisk -C "${ast_confdir}/asterisk.conf" ${OPTS} >/dev/null 2>&1 |
292 |
- result=$? |
293 |
- fi |
294 |
- |
295 |
- if [ "$result" -eq 0 ]; then |
296 |
- echo "Asterisk terminated normally" |
297 |
- break |
298 |
- else |
299 |
- if [ "$result" -gt 128 ]; then |
300 |
- signal="$(expr "$result" - 128)" |
301 |
- MSG="Asterisk terminated with Signal: $signal" |
302 |
- |
303 |
- CORE_TARGET="core-" |
304 |
- yesno "${ASTERISK_CORE_USEHOSTNAME}" && CORE_TARGET+="$(hostname)-" |
305 |
- CORE_TARGET+="$(date "+%Y%m%d-%H%M%S")" |
306 |
- |
307 |
- local CORE_DUMPED=0 |
308 |
- if [ -f "${ASTERISK_CORE_DIR}/core" ]; then |
309 |
- mv "${ASTERISK_CORE_DIR}/core" \ |
310 |
- "${ASTERISK_CORE_DIR}/${CORE_TARGET}" |
311 |
- CORE_DUMPED=1 |
312 |
- |
313 |
- elif [ -f "${ASTERISK_CORE_DIR}/core.${PID}" ]; then |
314 |
- mv "${ASTERISK_CORE_DIR}/core.${PID}" \ |
315 |
- "${ASTERISK_CORE_DIR}/${CORE_TARGET}" |
316 |
- CORE_DUMPED=1 |
317 |
- |
318 |
- fi |
319 |
- |
320 |
- [ $CORE_DUMPED -eq 1 ] && \ |
321 |
- MSG="${MSG}\n\rCore dumped: ${ASTERISK_CORE_DIR}/${CORE_TARGET}" |
322 |
- else |
323 |
- MSG="Asterisk terminated with return code: $result" |
324 |
- fi |
325 |
- |
326 |
- # kill left-over tasks |
327 |
- for X in ${ASTERISK_CLEANUP_ON_CRASH}; do |
328 |
- kill -9 "$(pidof "${X}")"; |
329 |
- done |
330 |
- fi |
331 |
- |
332 |
- [ -n "${TTY}" ] \ |
333 |
- && echo "${MSG}" >"${TTY}" \ |
334 |
- || echo "${MSG}" |
335 |
- |
336 |
- |
337 |
- if [ -n "${ASTERISK_NOTIFY_EMAIL}" ] && \ |
338 |
- [ -x /usr/sbin/sendmail ]; then |
339 |
- echo -e -n "Subject: Asterisk crashed\r\n${MSG}\r\n" |\ |
340 |
- /usr/sbin/sendmail "${ASTERISK_NOTIFY_EMAIL}" |
341 |
- fi |
342 |
- sleep "${ASTERISK_RESTART_DELAY}" |
343 |
- echo "Restarting Asterisk..." |
344 |
- done |
345 |
- |
346 |
- echo "Terminating wrapper loop." |
347 |
- return 0 |
348 |
-} |
349 |
- |
350 |
-start() { |
351 |
- local OPTS PID |
352 |
- local tmp x |
353 |
- |
354 |
- local OPTS ARGS |
355 |
- |
356 |
- setup_svc_variables || return $? |
357 |
- |
358 |
- ebegin "Starting ${ast_instancename} PBX" |
359 |
- |
360 |
- eindent |
361 |
- |
362 |
- # filter (redundant) arguments |
363 |
- OPTS="$(echo "${ASTERISK_OPTS}" | sed -re "s:-[cfF]::g")" |
364 |
- |
365 |
- # default options |
366 |
- OPTS="${OPTS} -f" # don't fork / detach breaks wrapper script... |
367 |
- |
368 |
- # ensure that ASTERISK_RESTART_DELAY is integer. |
369 |
- ASTERISK_RESTART_DELAY="$(echo "${ASTERISK_RESTART_DELAY}" | sed -re 's/^([0-9]*).*/\1/')" |
370 |
- [ -z "${ASTERISK_RESTART_DELAY}" ] && ASTERISK_RESTART_DELAY=5 |
371 |
- |
372 |
- if [ -n "${ASTERISK_CORE_SIZE}" ] && |
373 |
- [ "${ASTERISK_CORE_SIZE}" != "0" ]; then |
374 |
- ulimit -c ${ASTERISK_CORE_SIZE} |
375 |
- |
376 |
- if [ -n "${ASTERISK_CORE_DIR}" ] && \ |
377 |
- [ ! -d "${ASTERISK_CORE_DIR}" ] |
378 |
- then |
379 |
- checkpath -d -m 0755 -o ${ast_user}:${ast_group} "${ASTERISK_CORE_DIR}" |
380 |
- fi |
381 |
- ASTERISK_CORE_DIR="${ASTERISK_CORE_DIR:-/tmp}" |
382 |
- |
383 |
- cd "${ASTERISK_CORE_DIR}" |
384 |
- einfo "Core dump size : ${ASTERISK_CORE_SIZE}" |
385 |
- einfo "Core dump location : ${ASTERISK_CORE_DIR}" |
386 |
- |
387 |
- OPTS="${OPTS} -g" |
388 |
- fi |
389 |
- |
390 |
- if [ -n "${ASTERISK_MAX_FD}" ]; then |
391 |
- ulimit -n ${ASTERISK_MAX_FD} |
392 |
- einfo "Max open filedescriptors : ${ASTERISK_MAX_FD}" |
393 |
- fi |
394 |
- |
395 |
- if [ -n "${ASTERISK_NICE}" ]; then |
396 |
- if [ ${ASTERISK_NICE} -ge -20 ] && \ |
397 |
- [ ${ASTERISK_NICE} -le 19 ]; then |
398 |
- einfo "Nice level : ${ASTERISK_NICE}" |
399 |
- NICE="nice -n ${ASTERISK_NICE} --" |
400 |
- else |
401 |
- eerror "Nice value must be between -20 and 19" |
402 |
- return 1 |
403 |
- fi |
404 |
- else |
405 |
- NICE="" |
406 |
- fi |
407 |
- |
408 |
- if [ -n "${ASTERISK_NOTIFY_EMAIL}" ]; then |
409 |
- if [ -x /usr/sbin/sendmail ]; then |
410 |
- einfo "Email notifications go to : ${ASTERISK_NOTIFY_EMAIL}" |
411 |
- else |
412 |
- ewarn "Notifications disabled, /usr/sbin/sendmail doesn't exist or is not executable!" |
413 |
- unset ASTERISK_NOTIFY_EMAIL |
414 |
- fi |
415 |
- fi |
416 |
- |
417 |
- if [ -n "${ASTERISK_TTY}" ]; then |
418 |
- for x in "${ASTERISK_TTY}" \ |
419 |
- "/dev/tty${ASTERISK_TTY}" \ |
420 |
- "/dev/vc/${ASTERISK_TTY}" |
421 |
- do |
422 |
- if [ -c "${x}" ]; then |
423 |
- TTY="${x}" |
424 |
- fi |
425 |
- done |
426 |
- [ -n "${TTY}" ] && \ |
427 |
- einfo "Messages are sent to : ${TTY}" |
428 |
- fi |
429 |
- |
430 |
- if yesno "${ASTERISK_CONSOLE}" && [ -n "${TTY}" ]; then |
431 |
- einfo "Starting Asterisk console : Yes" |
432 |
- OPTS="${OPTS} -c" |
433 |
- fi |
434 |
- |
435 |
- if ! getent passwd "${ast_user}" &>/dev/null; then |
436 |
- eerror "Requested to run asterisk as ${ast_user}, which doesn't exist." |
437 |
- return 1 |
438 |
- fi |
439 |
- OPTS="${OPTS} -U ${ast_user}" |
440 |
- |
441 |
- if [ -n "${ast_group}" ] && ! getent group "${ast_group}" &>/dev/null; then |
442 |
- eerror "Requested to run ${ast_instancename} with group ${ast_group}, which doesn't exist." |
443 |
- return 1 |
444 |
- fi |
445 |
- [ -n "${ast_group}" ] && OPTS="${OPTS} -G ${ast_group}" |
446 |
- |
447 |
- if [ "${ast_user}" = root ]; then |
448 |
- ewarn "Starting asterisk as root is not recommended (SERIOUS SECURITY CONSIDERATIONS)." |
449 |
- elif [ "${ast_group}" = root ]; then |
450 |
- ewarn "Starting asterisk with group root is not recommended (SERIOUS SECURITY CONSIDERATIONS)." |
451 |
- fi |
452 |
- |
453 |
- checkpath -d -m 0755 -o "${ast_user}:${ast_group}" "${ast_logdir}" "${ast_rundir}" |
454 |
- checkpath -d -m 0750 -o "${ast_user}:${ast_group}" "${ast_cachedir}" |
455 |
- |
456 |
- einfo "Starting asterisk as : ${ast_user}:${ast_group:-${ast_pgroup} (+supplementaries)}" |
457 |
- asterisk_run_loop ${OPTS} 2>&1 | logger -t "wrapper:${ast_instancename}" &>/dev/null & |
458 |
- result=$? |
459 |
- |
460 |
- if [ $result -eq 0 ]; then |
461 |
- # 2 seconds should be enough for asterisk to start |
462 |
- sleep 2 |
463 |
- is_running |
464 |
- result=$? |
465 |
- |
466 |
- [ $result -eq 0 ] || wrapperstop |
467 |
- fi |
468 |
- |
469 |
- eoutdent |
470 |
- eend $result |
471 |
- |
472 |
- if [ $result -eq 0 ] && yesno "${ASTERISK_WAITBOOTED}"; then |
473 |
- if [ ! -r "${ast_rundir}/asterisk.ctl" ]; then |
474 |
- # asterisk can crash during startup ... |
475 |
- ebegin "Waiting for ctl file to appear" |
476 |
- while is_running && [ ! -r "${ast_rundir}/asterisk.ctl" ]; do |
477 |
- sleep 1 |
478 |
- done |
479 |
- is_running |
480 |
- result=$? |
481 |
- eend $result |
482 |
- fi |
483 |
- if [ $result -eq 0 ]; then |
484 |
- ebegin "Waiting for ${ast_instancename} to fully boot" |
485 |
- /usr/sbin/asterisk -C "${ast_confdir}/asterisk.conf" -r -x "core waitfullybooted" &>/dev/null |
486 |
- eend $? |
487 |
- fi |
488 |
- fi |
489 |
- |
490 |
- return $result |
491 |
-} |
492 |
- |
493 |
-wrapperstop() { |
494 |
- # Accomodate system upgrades (so a previous version of the wrapper script that still uses a pid file may be running). |
495 |
- if [ -r "${ast_rundir}/wrapper_loop.pid" ]; then |
496 |
- ebegin "Killing ${ast_instancename} wrapper script" |
497 |
- kill "$(cat /run/asterisk/wrapper_loop.pid)" |
498 |
- eend $? |
499 |
- fi |
500 |
- |
501 |
- # The new one (due to "hardened" requirements) uses a simpler |
502 |
- # flag to indicate running or shutting down. |
503 |
- if [ -r "${ast_rundir}/wrapper_loop.running" ]; then |
504 |
- ebegin "Signalling ${ast_instancename} wrapper script to terminate" |
505 |
- rm "${ast_rundir}/wrapper_loop.running" |
506 |
- eend $? |
507 |
- fi |
508 |
- |
509 |
- return 0 |
510 |
-} |
511 |
- |
512 |
-forcestop() { |
513 |
- setup_svc_variables || return $? |
514 |
- |
515 |
- # Just to be sure - when we want to forcestop we should make it all tear down. |
516 |
- wrapperstop |
517 |
- |
518 |
- ebegin "Stopping ${ast_instancename} PBX" |
519 |
- start-stop-daemon --stop --pidfile /run/asterisk/asterisk.pid |
520 |
- eend $? |
521 |
-} |
522 |
- |
523 |
-stop() { |
524 |
- setup_svc_variables || return $? |
525 |
- |
526 |
- wrapperstop |
527 |
- |
528 |
- if ! is_running; then |
529 |
- eerror "${ast_instancename} is not running!" |
530 |
- return 0 |
531 |
- fi |
532 |
- |
533 |
- ebegin "Stopping ${ast_instancename} PBX ${ast_stop_method}" |
534 |
- /usr/sbin/asterisk -C "${ast_confdir}/asterisk.conf" -r -x "core stop ${ast_stop_method}" &>/dev/null |
535 |
- # Now we have to wait until asterisk has _really_ stopped. |
536 |
- sleep 1 |
537 |
- if is_running; then |
538 |
- einfon "Waiting for ${ast_instancename} to shutdown ." |
539 |
- local cnt=0 |
540 |
- while is_running; do |
541 |
- cnt="$(expr $cnt + 2)" |
542 |
- if [ ${ast_stop_timeout} -gt 0 -a $cnt -gt ${ast_stop_timeout} ] ; then |
543 |
- echo |
544 |
- eend 1 "Failed waiting for ${ast_instancename} to stop." |
545 |
- return 1 |
546 |
- fi |
547 |
- sleep 2 |
548 |
- echo -n "." |
549 |
- done |
550 |
- echo |
551 |
- fi |
552 |
- eend 0 |
553 |
-} |
554 |
- |
555 |
-reload() { |
556 |
- setup_svc_variables || return $? |
557 |
- |
558 |
- if is_running; then |
559 |
- ebegin "Forcing ${ast_instancename} to reload configuration" |
560 |
- /usr/sbin/asterisk -C "${ast_confdir}/asterisk.conf" -r -x "module reload" &>/dev/null |
561 |
- eend $? |
562 |
- else |
563 |
- eerror "${ast_instancename} is not running!" |
564 |
- fi |
565 |
-} |