~singpolyma/asterisk

ref: 1133eb1b6c28b0a2aabda8257f8d4afdab0c5b97 asterisk/contrib/scripts/asterisk_cleanup -rw-r--r-- 616 bytes
1133eb1b — Tzafrir Cohen A systemd service 3 years ago
                                                                                
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