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 32 32 33 33 . /etc/amportal.conf 34 34 35 if [ -z $PIDOF ]; then 36 PIDOF=pidof 37 fi 38 35 39 if [ $ASTRUNDIR = /var/run ] 36 40 then 37 41 echo "**** ERROR IN CONFIGURATION ****" 38 echo "astrundir in /etc/asterisk/asterisk.confis set to '/var/run' - THIS IS WRONG."42 echo "astrundir in '$ASTETCDIR' is set to '/var/run' - THIS IS WRONG." 39 43 echo "Please change it to something sensible (eg, '/var/run/asterisk') and re-run" 40 44 echo "install_amp" 41 45 exit; … … 44 48 if [ ! -d "$ASTRUNDIR" ] 45 49 then 46 50 echo "**** WARNING: ERROR IN CONFIGURATION ****" 47 echo "astrundir in /etc/asterisk/asterisk.confis set to $ASTRUNDIR but the directory"51 echo "astrundir in '$ASTETCDIR' is set to $ASTRUNDIR but the directory" 48 52 echo "does not exists. Attempting to create it with: 'mkdir -p $ASTRUNDIR'" 49 53 echo 50 54 mkdir -p $ASTRUNDIR … … 62 66 echo SETTING FILE PERMISSIONS 63 67 64 68 chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $ASTRUNDIR 65 chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP /etc/asterisk66 chmod -R g+w /etc/asterisk69 chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $ASTETCDIR 70 chmod -R g+w $ASTETCDIR 67 71 chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $ASTVARLIBDIR 68 72 chmod -R g+w $ASTVARLIBDIR 69 73 chown -R $AMPASTERISKUSER:$AMPASTERISKGROUP $ASTLOGDIR … … 106 110 107 111 check_asterisk() { 108 112 # 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 115 pid_length=`$PIDOF asterisk|awk '{print length($0)}'` 111 116 if [ "$pid_length" == "0" -a "$pid_length" != "" ] 112 117 then 113 118 killall -9 safe_asterisk … … 125 130 # check to see if asterisk is running 126 131 echo 127 132 echo "STARTING ASTERISK" 128 pid_length=` pidofasterisk|awk '{print length($0)}'`133 pid_length=`$PIDOF asterisk|awk '{print length($0)}'` 129 134 if [ "$pid_length" != "0" -a "$pid_length" != "" ] 130 135 then 131 136 echo "Asterisk is already running" … … 145 150 stop_asterisk() { 146 151 echo 147 152 echo "STOPPING ASTERISK" 148 pid_length=` pidofasterisk|awk '{print length($0)}'`153 pid_length=`$PIDOF asterisk|awk '{print length($0)}'` 149 154 if [ "$pid_length" != "0" -a "$pid_length" != "" ] 150 155 then 151 156 /usr/sbin/asterisk -rx "core stop gracefully" | grep -v "No such command" … … 156 161 157 162 check_fop() { 158 163 #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)}'` 160 165 if [ "$pid_length" == "0" -a "$pid_length" != "" ] 161 166 then 162 167 ps -ef | grep safe_opserver | grep -v grep | awk '{print $2}' | xargs kill -9 … … 173 178 # check to see if FOP is running 174 179 echo 175 180 echo "STARTING FOP SERVER" 176 pid_length=` pidof-x op_server.pl|awk '{print length($0)}'`181 pid_length=`$PIDOF -x op_server.pl|awk '{print length($0)}'` 177 182 if [ "$pid_length" != "0" -a "$pid_length" != "" ] 178 183 then 179 184 echo "FOP server is already running" … … 190 195 stop_fop() { 191 196 echo 192 197 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)}'` 194 199 if [ "$pid_length" != "0" -a "$pid_length" != "" ] 195 200 then 196 201 ps -ef | grep safe_opserver | grep -v grep | awk '{print $2}' | xargs kill
