File: asterisk_cleanup

package info (click to toggle)
asterisk 1:13.14.1~dfsg-2+deb9u4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 50,572 kB
  • sloc: ansic: 675,986; sh: 11,363; python: 3,925; sql: 3,634; makefile: 3,153; perl: 3,103; yacc: 2,164; cpp: 2,093; xml: 786; tcl: 113; php: 62
file content (18 lines) | stat: -rw-r--r-- 616 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh

# asterisk_cleanup: A script intended to optionally be run when Asterisk
# has exited. This example script is used to move core files.

VARLIBDIR=${VARLIBDIR:/var/lib/asterisk}
RUNDIR=${VARRUNDIR:/var/run/asterisk}
DUMPDROP=${DUMPDROP:-/var/spool/asterisk/cores}
ASTPIDFILE=${ASTVARRUNDIR}/asterisk.pid
PID=`cat ${ASTPIDFILE}`
DATE=`date "+%Y-%m-%dT%H:%M:%S%z"`
if test -f ${RUNDIR}/core.${PID} ; then
	mkdir -p "${DUMPDROP}"
	mv ${RUNDIR}/core.${PID} ${DUMPDROP}/core.`hostname`-$DATE &
elif test -f ${RUNDIR}/core ; then
	mkdir -p "${DUMPDROP}"
	mv ${RUNDIR}/core ${DUMPDROP}/core.`hostname`-$DATE &
fi