summaryrefslogtreecommitdiff
path: root/contrib/scripts
diff options
context:
space:
mode:
authorMichiel van Baak <michiel@vanbaak.info>2009-02-21 13:13:35 +0000
committerMichiel van Baak <michiel@vanbaak.info>2009-02-21 13:13:35 +0000
commit5b497da128f224f09c6e779b5e808304d61bd5b9 (patch)
tree93fbf45ec6291d167e7a644983bb0f63f5141661 /contrib/scripts
parentd9eb973a3de4c073b7ee4831270f2657a3da44de (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/scripts')
-rw-r--r--contrib/scripts/safe_asterisk8
1 files changed, 7 insertions, 1 deletions
diff --git a/contrib/scripts/safe_asterisk b/contrib/scripts/safe_asterisk
index 6f3b5ebef..367f6a6a9 100644
--- a/contrib/scripts/safe_asterisk
+++ b/contrib/scripts/safe_asterisk
@@ -12,7 +12,8 @@ MACHINE=`hostname` # To specify which machine has crashed when getting the mai
DUMPDROP=/tmp
SLEEPSECS=4
ASTSBINDIR=__ASTERISK_SBIN_DIR__
-ASTPIDFILE=__ASTERISK_VARRUN_DIR__/asterisk.pid
+ASTVARRUNDIR=__ASTERISK_VARRUN_DIR__
+ASTPIDFILE=${ASTVARRUNDIR}/asterisk.pid
# comment this line out to have this script _not_ kill all mpg123 processes when
# asterisk exits
@@ -91,6 +92,11 @@ else
# set the process's filemax to whatever set above
ulimit -n $MAXFILES
+ if [ ! -d ${ASTVARRUNDIR} ]; then
+ mkdir -p ${ASTVARRUNDIR}
+ chmod 770 ${ASTVARRUNDIR}
+ fi
+
fi
if test "x$UMASK" != "x"; then