Ticket #3639: freepbx_engine.pidof+harcoded_fix.diff

File freepbx_engine.pidof+harcoded_fix.diff, 3.6 kB (added by tbyte, 3 years ago)
  • freepbx_engine

    old new  
    3232 
    3333. /etc/amportal.conf 
    3434 
     35if [ -z $PIDOF ]; then 
     36    PIDOF=pidof 
     37fi 
     38 
    3539if [ $ASTRUNDIR = /var/run ] 
    3640  then 
    3741    echo "**** ERROR IN CONFIGURATION ****" 
    38     echo "astrundir in /etc/asterisk/asterisk.conf is set to '/var/run' - THIS IS WRONG." 
     42    echo "astrundir in '$ASTETCDIR' is set to '/var/run' - THIS IS WRONG." 
    3943    echo "Please change it to something sensible (eg, '/var/run/asterisk') and re-run" 
    4044    echo "install_amp" 
    4145    exit; 
     
    4448if [ ! -d "$ASTRUNDIR" ] 
    4549  then 
    4650    echo "**** WARNING: ERROR IN CONFIGURATION ****" 
    47     echo "astrundir in /etc/asterisk/asterisk.conf is set to $ASTRUNDIR but the directory" 
     51    echo "astrundir in '$ASTETCDIR' is set to $ASTRUNDIR but the directory" 
    4852    echo "does not exists. Attempting to create it with: 'mkdir -p $ASTRUNDIR'" 
    4953    echo 
    5054    mkdir -p $ASTRUNDIR 
     
    6266  echo SETTING FILE PERMISSIONS 
    6367 
    6468  chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $ASTRUNDIR 
    65   chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP /etc/asterisk 
    66   chmod -R g+w /etc/asterisk 
     69  chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $ASTETCDIR 
     70  chmod -R g+w $ASTETCDIR 
    6771  chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $ASTVARLIBDIR 
    6872  chmod -R g+w $ASTVARLIBDIR 
    6973  chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $ASTLOGDIR 
     
    106110 
    107111check_asterisk() { 
    108112# 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)}'` 
     113# Note, this isn't fool-proof.  If safe_asterisk is constantly restarting a dying asterisk, 
     114# then there is a chance pidof will return non zero.  We call this twice to reduce chances of this happening 
     115pid_length=`$PIDOF asterisk|awk '{print length($0)}'` 
    111116  if [ "$pid_length" == "0" -a "$pid_length" != "" ] 
    112117    then 
    113118        killall -9 safe_asterisk 
     
    125130# check to see if asterisk is running 
    126131echo 
    127132echo "STARTING ASTERISK" 
    128 pid_length=`pidof asterisk|awk '{print length($0)}'` 
     133pid_length=`$PIDOF asterisk|awk '{print length($0)}'` 
    129134  if [ "$pid_length" != "0" -a "$pid_length" != "" ] 
    130135    then 
    131136      echo "Asterisk is already running" 
     
    145150stop_asterisk() { 
    146151echo 
    147152echo "STOPPING ASTERISK" 
    148 pid_length=`pidof asterisk|awk '{print length($0)}'` 
     153pid_length=`$PIDOF asterisk|awk '{print length($0)}'` 
    149154  if [ "$pid_length" != "0" -a "$pid_length" != "" ] 
    150155    then 
    151156      /usr/sbin/asterisk -rx "core stop gracefully" | grep -v "No such command" 
     
    156161 
    157162check_fop() { 
    158163#check to see if FOP is running 
    159   pid_length=`pidof -x op_server.pl|awk '{print length($0)}'` 
     164  pid_length=`$PIDOF -x op_server.pl|awk '{print length($0)}'` 
    160165  if [ "$pid_length" == "0" -a "$pid_length" != "" ] 
    161166    then 
    162167        ps -ef | grep safe_opserver | grep -v grep | awk '{print $2}' | xargs kill -9 
     
    173178# check to see if FOP is running 
    174179echo 
    175180echo "STARTING FOP SERVER" 
    176 pid_length=`pidof -x op_server.pl|awk '{print length($0)}'` 
     181pid_length=`$PIDOF -x op_server.pl|awk '{print length($0)}'` 
    177182  if [ "$pid_length" != "0" -a "$pid_length" != "" ] 
    178183    then 
    179184      echo "FOP server is already running" 
     
    190195stop_fop() { 
    191196  echo 
    192197  echo "STOPPING FOP SERVER" 
    193   pid_length=`pidof -x op_server.pl|awk '{print length($0)}'` 
     198  pid_length=`$PIDOF -x op_server.pl|awk '{print length($0)}'` 
    194199    if [ "$pid_length" != "0" -a "$pid_length" != "" ] 
    195200      then 
    196201        ps -ef | grep safe_opserver | grep -v grep | awk '{print $2}' | xargs kill