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

rc: try refreshing php-cgi through SIGHUP instead

parent 5c2589ce
......@@ -26,18 +26,26 @@
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)) {
return mwexecf('/bin/pkill -%s -F %s', array($sig, $pidfile), true);
mwexecf('/bin/pkill -%s %s', array($sig, $procname));
}
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 = "";
if (file_exists($pidfile)) {
exec("/bin/pgrep -nF {$pidfile}", $output, $retval);
......@@ -53,14 +61,6 @@ function is_process_running($process)
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 = '')
{
if ($subsystem == '') {
......@@ -987,7 +987,7 @@ function mwexecf($format, $args = array(), $mute = false, $clearsigmask = false)
$args[$id] = escapeshellarg($arg);
}
mwexec(vsprintf($format, $args), $mute, $clearsigmask);
return mwexec(vsprintf($format, $args), $mute, $clearsigmask);
}
/* wrapper for exec() */
......
......@@ -87,7 +87,7 @@ case ${opmode} in
/usr/sbin/tcpdump -s 256 -v -S -l -n -e -ttt -i pflog0
;;
11)
/usr/local/etc/rc.restart_webgui please
/usr/local/etc/rc.restart_webgui
;;
12)
/usr/local/etc/rc.initial.firmware
......
......@@ -47,7 +47,7 @@ pkg upgrade -y
echo
# restart the GUI after PHP changes have been applied
/usr/local/etc/rc.restart_webgui please
/usr/local/etc/rc.restart_webgui
echo
......
......@@ -460,7 +460,7 @@ if (!$dry_run) {
services_dhcpd_configure();
}
if ($restart_webgui) {
mwexec('/usr/local/etc/rc.restart_webgui please');
mwexec('/usr/local/etc/rc.restart_webgui');
}
}
......
#!/usr/local/bin/php
<?php
require_once("config.inc");
require_once("functions.inc");
require_once("shaper.inc");
require_once("captiveportal.inc");
require_once("rrd.inc");
require_once('config.inc');
require_once('functions.inc');
require_once('shaper.inc');
require_once('captiveportal.inc');
require_once('rrd.inc');
echo "Restarting webConfigurator...";
echo 'Restarting webConfigurator...';
killbyname("lighttpd");
killbyname('lighttpd');
if ($argc > 1) {
/*
* Force killing all php-cgi children as well
* to avoid hiccups with moved include files.
*/
killbyname("php-cgi");
}
/*
* Force reloading all php-cgi children to
* avoid hiccups with moved include files.
*/
killbyname('php-cgi', 'HUP');
while (is_process_running("lighttpd")) {
while (is_process_running('lighttpd')) {
echo '.';
sleep(1);
}
......@@ -28,4 +26,4 @@ system_webgui_start();
captiveportal_init_webgui();
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