Commit 5427a3d6 authored by Franco Fichtner's avatar Franco Fichtner

rc: try refreshing php-cgi through SIGHUP instead

parent 5c2589ce
...@@ -26,18 +26,26 @@ ...@@ -26,18 +26,26 @@
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
function killbypid($pidfile, $sig = 'TERM') function killbyname($procname, $sig = 'TERM')
{ {
/* return 1 for success and 0 for a failure */ if (!is_process_running($procname)) {
return;
}
if (file_exists($pidfile)) { mwexecf('/bin/pkill -%s %s', array($sig, $procname));
return mwexecf('/bin/pkill -%s -F %s', array($sig, $pidfile), true); }
function killbypid($pidfile, $sig = 'TERM')
{
if (!file_exists($pidfile)) {
return;
} }
return 0; mwexecf('/bin/pkill -%s -F %s', array($sig, $pidfile));
} }
function isvalidpid($pidfile) { function isvalidpid($pidfile)
{
$output = ""; $output = "";
if (file_exists($pidfile)) { if (file_exists($pidfile)) {
exec("/bin/pgrep -nF {$pidfile}", $output, $retval); exec("/bin/pgrep -nF {$pidfile}", $output, $retval);
...@@ -53,14 +61,6 @@ function is_process_running($process) ...@@ -53,14 +61,6 @@ function is_process_running($process)
return (intval($retval) == 0); return (intval($retval) == 0);
} }
/* kill a process by name */
function killbyname($procname)
{
if (is_process_running($procname)) {
mwexec('/usr/bin/killall ' . escapeshellarg($procname));
}
}
function is_subsystem_dirty($subsystem = '') function is_subsystem_dirty($subsystem = '')
{ {
if ($subsystem == '') { if ($subsystem == '') {
...@@ -987,7 +987,7 @@ function mwexecf($format, $args = array(), $mute = false, $clearsigmask = false) ...@@ -987,7 +987,7 @@ function mwexecf($format, $args = array(), $mute = false, $clearsigmask = false)
$args[$id] = escapeshellarg($arg); $args[$id] = escapeshellarg($arg);
} }
mwexec(vsprintf($format, $args), $mute, $clearsigmask); return mwexec(vsprintf($format, $args), $mute, $clearsigmask);
} }
/* wrapper for exec() */ /* wrapper for exec() */
......
...@@ -87,7 +87,7 @@ case ${opmode} in ...@@ -87,7 +87,7 @@ case ${opmode} in
/usr/sbin/tcpdump -s 256 -v -S -l -n -e -ttt -i pflog0 /usr/sbin/tcpdump -s 256 -v -S -l -n -e -ttt -i pflog0
;; ;;
11) 11)
/usr/local/etc/rc.restart_webgui please /usr/local/etc/rc.restart_webgui
;; ;;
12) 12)
/usr/local/etc/rc.initial.firmware /usr/local/etc/rc.initial.firmware
......
...@@ -47,7 +47,7 @@ pkg upgrade -y ...@@ -47,7 +47,7 @@ pkg upgrade -y
echo echo
# restart the GUI after PHP changes have been applied # restart the GUI after PHP changes have been applied
/usr/local/etc/rc.restart_webgui please /usr/local/etc/rc.restart_webgui
echo echo
......
...@@ -460,7 +460,7 @@ if (!$dry_run) { ...@@ -460,7 +460,7 @@ if (!$dry_run) {
services_dhcpd_configure(); services_dhcpd_configure();
} }
if ($restart_webgui) { if ($restart_webgui) {
mwexec('/usr/local/etc/rc.restart_webgui please'); mwexec('/usr/local/etc/rc.restart_webgui');
} }
} }
......
#!/usr/local/bin/php #!/usr/local/bin/php
<?php <?php
require_once("config.inc"); require_once('config.inc');
require_once("functions.inc"); require_once('functions.inc');
require_once("shaper.inc"); require_once('shaper.inc');
require_once("captiveportal.inc"); require_once('captiveportal.inc');
require_once("rrd.inc"); require_once('rrd.inc');
echo "Restarting webConfigurator..."; echo 'Restarting webConfigurator...';
killbyname("lighttpd"); killbyname('lighttpd');
if ($argc > 1) { /*
/* * Force reloading all php-cgi children to
* Force killing all php-cgi children as well * avoid hiccups with moved include files.
* to avoid hiccups with moved include files. */
*/ killbyname('php-cgi', 'HUP');
killbyname("php-cgi");
}
while (is_process_running("lighttpd")) { while (is_process_running('lighttpd')) {
echo '.'; echo '.';
sleep(1); sleep(1);
} }
...@@ -28,4 +26,4 @@ system_webgui_start(); ...@@ -28,4 +26,4 @@ system_webgui_start();
captiveportal_init_webgui(); captiveportal_init_webgui();
enable_rrd_graphing(); enable_rrd_graphing();
echo "done.\n"; echo 'done.' . PHP_EOL;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment