|
Revision 14083, 2.0 kB
(checked in by p_lindheimer, 1 year ago)
|
fixes #5818 stop fop if it is running and remove the amportal hook so subsequent start's don't start it
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
global $amp_conf; |
|---|
| 15 |
|
|---|
| 16 |
$pidof = fpbx_which("pidof"); |
|---|
| 17 |
if ($pidof === false) { |
|---|
| 18 |
$pidof = "/sbin/pidof"; |
|---|
| 19 |
} |
|---|
| 20 |
$awk = fpbx_which("awk"); |
|---|
| 21 |
$ps = fpbx_which("ps"); |
|---|
| 22 |
$grep = fpbx_which("grep"); |
|---|
| 23 |
$xargs = fpbx_which("xargs"); |
|---|
| 24 |
$echo = fpbx_which("echo"); |
|---|
| 25 |
$kill = fpbx_which("kill"); |
|---|
| 26 |
$killall = fpbx_which("killall"); |
|---|
| 27 |
|
|---|
| 28 |
outn("Checking FOP servers status.."); |
|---|
| 29 |
$pid_length = trim(`$pidof -x op_server.pl | $awk '{print length($0)}'`); |
|---|
| 30 |
if ($pid_length) { |
|---|
| 31 |
out("running got $pid_length"); |
|---|
| 32 |
outn("Trying to stop safe_opserver.."); |
|---|
| 33 |
$kill_args = trim(`$ps -ef | $grep safe_opserver | $grep -v grep | $awk '{print $2}' | $xargs $echo`); |
|---|
| 34 |
outn("processes $kill_args.."); |
|---|
| 35 |
exec("$kill $kill_args", $kill_arr, $ret); |
|---|
| 36 |
if (!$ret) { |
|---|
| 37 |
out("stopped"); |
|---|
| 38 |
outn("trying to stop op_server.pl.."); |
|---|
| 39 |
exec("$killall op_server.pl", $killall_arr, $ret); |
|---|
| 40 |
if (!$ret) { |
|---|
| 41 |
out("stopped"); |
|---|
| 42 |
} else { |
|---|
| 43 |
out("failed"); |
|---|
| 44 |
out("you may need to reboot the server to stop the FOP services"); |
|---|
| 45 |
} |
|---|
| 46 |
} else { |
|---|
| 47 |
out("failed"); |
|---|
| 48 |
out("you may need to reboot the server to stop the FOP services"); |
|---|
| 49 |
} |
|---|
| 50 |
} else { |
|---|
| 51 |
out("not running"); |
|---|
| 52 |
} |
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
$hook = $amp_conf['AMPBIN'] . "/freepbx_engine_hook_fw_fop"; |
|---|
| 60 |
if (is_link($hook) || is_file($hook)) { |
|---|
| 61 |
outn("removing freepbx_engine_hook_fw_fop.."); |
|---|
| 62 |
if (unlink($hook)) { |
|---|
| 63 |
out("removed"); |
|---|
| 64 |
} else { |
|---|
| 65 |
out("failed to remove"); |
|---|
| 66 |
out("ERROR: The following symlink/file must be removed: $hook"); |
|---|
| 67 |
} |
|---|
| 68 |
} else { |
|---|
| 69 |
out("$hook is not there"); |
|---|
| 70 |
} |
|---|
| 71 |
|
|---|