Changeset 8170

Show
Ignore:
Timestamp:
08/25/09 19:03:54 (1 year ago)
Author:
p_lindheimer
Message:

fixes #3639 allows pidof to be defined and removes hard coded /etc/asterisk path

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/branches/2.6/amp_conf/bin/freepbx_engine

    r6816 r8170  
    3030AMPASTERISKWEBGROUP=$AMPASTERISKGROUP 
    3131AMPVMUMASK=077 
     32ASTETCDIR=/etc/asterisk 
    3233 
    3334. /etc/amportal.conf 
     35 
     36if [ -z $PIDOF ]; then 
     37    PIDOF=pidof 
     38fi 
    3439 
    3540if [ $ASTRUNDIR = /var/run ] 
    3641  then 
    3742    echo "**** ERROR IN CONFIGURATION ****" 
    38     echo "astrundir in /etc/asterisk/asterisk.conf is set to '/var/run' - THIS IS WRONG." 
     43    echo "astrundir in '$ASTETCDIR' is set to '/var/run' - THIS IS WRONG." 
    3944    echo "Please change it to something sensible (eg, '/var/run/asterisk') and re-run" 
    4045    echo "install_amp" 
     
    4550  then 
    4651    echo "**** WARNING: ERROR IN CONFIGURATION ****" 
    47     echo "astrundir in /etc/asterisk/asterisk.conf is set to $ASTRUNDIR but the directory" 
     52    echo "astrundir in '$ASTETCDIR' is set to $ASTRUNDIR but the directory" 
    4853                echo "does not exists. Attempting to create it with: 'mkdir -p $ASTRUNDIR'" 
    4954                echo 
     
    6368 
    6469        chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $ASTRUNDIR 
    65         chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP /etc/asterisk 
    66         chmod -R g+w /etc/asterisk 
     70        chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $ASTETCDIR 
     71        chmod -R g+w $ASTETCDIR 
    6772        chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $ASTVARLIBDIR 
    6873        chmod -R g+w $ASTVARLIBDIR 
     
    107112check_asterisk() { 
    108113# check to see if asterisk is running 
    109 # Note, this isn't fool-proof.  If safe_asterisk is constantly restarting a dying asterisk, then there is a chance pidof will return non zero.  We call this twice to reduce chances of this happening 
    110 pid_length=`pidof asterisk|awk '{print length($0)}'` 
     114# Note, this isn't fool-proof.  If safe_asterisk is constantly restarting a dying asterisk, 
     115# then there is a chance pidof will return non zero.  We call this twice to reduce chances of this happening 
     116pid_length=`$PIDOF asterisk|awk '{print length($0)}'` 
    111117        if [ "$pid_length" == "0" -a "$pid_length" != "" ] 
    112118                then 
     
    126132echo 
    127133echo "STARTING ASTERISK" 
    128 pid_length=`pidof asterisk|awk '{print length($0)}'` 
     134pid_length=`$PIDOF asterisk|awk '{print length($0)}'` 
    129135        if [ "$pid_length" != "0" -a "$pid_length" != "" ] 
    130136                then 
     
    146152echo 
    147153echo "STOPPING ASTERISK" 
    148 pid_length=`pidof asterisk|awk '{print length($0)}'` 
     154pid_length=`$PIDOF asterisk|awk '{print length($0)}'` 
    149155        if [ "$pid_length" != "0" -a "$pid_length" != "" ] 
    150156                then 
     
    157163check_fop() { 
    158164#check to see if FOP is running 
    159         pid_length=`pidof -x op_server.pl|awk '{print length($0)}'` 
     165        pid_length=`$PIDOF -x op_server.pl|awk '{print length($0)}'` 
    160166        if [ "$pid_length" == "0" -a "$pid_length" != "" ] 
    161167                then 
     
    174180echo 
    175181echo "STARTING FOP SERVER" 
    176 pid_length=`pidof -x op_server.pl|awk '{print length($0)}'` 
     182pid_length=`$PIDOF -x op_server.pl|awk '{print length($0)}'` 
    177183        if [ "$pid_length" != "0" -a "$pid_length" != "" ] 
    178184                then 
     
    191197        echo 
    192198        echo "STOPPING FOP SERVER" 
    193         pid_length=`pidof -x op_server.pl|awk '{print length($0)}'` 
     199        pid_length=`$PIDOF -x op_server.pl|awk '{print length($0)}'` 
    194200                if [ "$pid_length" != "0" -a "$pid_length" != "" ] 
    195201                        then