diff options
author | Michiel van Baak <michiel@vanbaak.info> | 2009-02-21 13:13:35 +0000 |
---|---|---|
committer | Michiel van Baak <michiel@vanbaak.info> | 2009-02-21 13:13:35 +0000 |
commit | 5b497da128f224f09c6e779b5e808304d61bd5b9 (patch) | |
tree | 93fbf45ec6291d167e7a644983bb0f63f5141661 /contrib/init.d/rc.archlinux.asterisk | |
parent | d9eb973a3de4c073b7ee4831270f2657a3da44de (diff) |
set ASTVARRUNDIR=$(localstatedir)/run/asterisk as default path
When running asterisk as non-root and without this patch the pidfile wants
to go into /var/run/asterisk.pid. This directory is not writable for
the non-root user and changing permissions is not an option.
Putting it in /var/run/asterisk/asterisk.pid makes it possible
to set permissions on the /var/run/asterisk dir so everything
works as it should be.
Patched committed is based on pabelanger's patch.
(closes issue #13153)
Reported by: pabelanger
Patches:
2009012900_bug13153-nonrootscripts.diff.txt uploaded by mvanbaak (license 7)
Review: http://reviewboard.digium.com/r/139/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@177852 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'contrib/init.d/rc.archlinux.asterisk')
-rwxr-xr-x | contrib/init.d/rc.archlinux.asterisk | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/contrib/init.d/rc.archlinux.asterisk b/contrib/init.d/rc.archlinux.asterisk index a4b7c633c..fec62af98 100755 --- a/contrib/init.d/rc.archlinux.asterisk +++ b/contrib/init.d/rc.archlinux.asterisk @@ -8,26 +8,31 @@ # . /etc/rc.conf . /etc/rc.d/functions +DAEMON=__ASTERISK_SBIN_DIR__/asterisk +ASTVARRUNDIR=__ASTERISK_VARRUN_DIR__ case "$1" in start) stat_busy "Starting Asterisk..." - if [ -x /usr/sbin/asterisk ]; then + if [ ! -d $ASTVARRUNDIR ]; then + mkdir -p $ASTVARRUNDIR + fi + if [ -x $DAEMON ]; then # Check if Asterisk is already running. If it is, then bug out, because # starting safe_asterisk when Asterisk is running is very bad. - VERSION=`/usr/sbin/asterisk -rx 'core show version'` + VERSION=`${DAEMON} -rx 'core show version'` if [ "`echo $VERSION | cut -c 1-8`" = "Asterisk" ]; then echo "Asterisk is already running. $0 will exit now." exit 1 fi - /usr/sbin/asterisk + ${DAEMON} stat_done fi ;; stop) - if [ -r /var/run/asterisk.pid ]; then + if [ -r ${ASTVARRUNDIR}/asterisk.pid ]; then stat_busy "Stoping Asterisk..." - asterisk -rx "core stop now" > /dev/null 2&>1 + ${DAEMON} -rx "core stop now" > /dev/null 2&>1 if [ $? -gt 0 ]; then stat_fail else |