Ticket #2646: freepbx_engine.patch
| File freepbx_engine.patch, 2.9 kB (added by jfinstrom, 4 years ago) |
|---|
-
freepbx_engine
old new 95 95 check_asterisk() { 96 96 # check to see if asterisk is running 97 97 # 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 98 pid_length= `pidof asterisk|awk '{print length($0)}'`98 pid_length=$(pidof asterisk|awk '{print length($0)}') 99 99 if [ "$pid_length" == "0" -a "$pid_length" != "" ] 100 100 then 101 101 killall -9 safe_asterisk … … 108 108 exit 0 109 109 fi 110 110 } 111 check_asterisk_kill() { 112 # check to see if asterisk is running after killall 113 # 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 114 pid_length=$(pidof asterisk|awk '{print length($0)}') 115 if [ "$pid_length" == "0" -a "$pid_length" != "" ] 116 then 117 killall -9 safe_asterisk 118 killall -9 asterisk 119 check_asterisk_kill 120 fi 121 } 111 122 112 123 run_asterisk() { 113 124 # check to see if asterisk is running 114 125 echo 115 126 echo "STARTING ASTERISK" 116 pid_length= `pidof asterisk|awk '{print length($0)}'`127 pid_length=$(pidof asterisk|awk '{print length($0)}') 117 128 if [ "$pid_length" != "0" -a "$pid_length" != "" ] 118 129 then 119 130 echo "Asterisk is already running" … … 132 143 stop_asterisk() { 133 144 echo 134 145 echo "STOPPING ASTERISK" 135 pid_length= `pidof asterisk|awk '{print length($0)}'`146 pid_length=$(pidof asterisk|awk '{print length($0)}') 136 147 if [ "$pid_length" != "0" -a "$pid_length" != "" ] 137 148 then 138 149 /usr/sbin/asterisk -rx "stop gracefully" … … 142 153 143 154 check_fop() { 144 155 #check to see if FOP is running 145 pid_length= `pidof -x op_server.pl|awk '{print length($0)}'`156 pid_length=$(pidof -x op_server.pl|awk '{print length($0)}') 146 157 if [ "$pid_length" == "0" -a "$pid_length" != "" ] 147 158 then 148 159 ps -ef | grep safe_opserver | grep -v grep | awk '{print $2}' | xargs kill -9 … … 159 170 # check to see if FOP is running 160 171 echo 161 172 echo "STARTING FOP SERVER" 162 pid_length= `pidof -x op_server.pl|awk '{print length($0)}'`173 pid_length=$(pidof -x op_server.pl|awk '{print length($0)}') 163 174 if [ "$pid_length" != "0" -a "$pid_length" != "" ] 164 175 then 165 176 echo "FOP server is already running" … … 174 185 stop_fop() { 175 186 echo 176 187 echo "STOPPING FOP SERVER" 177 pid_length= `pidof -x op_server.pl|awk '{print length($0)}'`188 pid_length=$(pidof -x op_server.pl|awk '{print length($0)}') 178 189 if [ "$pid_length" != "0" -a "$pid_length" != "" ] 179 190 then 180 191 ps -ef | grep safe_opserver | grep -v grep | awk '{print $2}' | xargs kill … … 188 199 echo "KILLING AMP PROCESSES" 189 200 killall -9 safe_asterisk 190 201 killall -9 asterisk 202 check_asterisk_kill 191 203 killall -9 mpg123 192 204 ps -ef | grep safe_opserver | grep -v grep | awk '{print $2}' | xargs kill -9 193 205 killall -9 op_server.pl
