inc: remove a useless wrapper

This commit is contained in:
Franco Fichtner 2015-04-01 09:51:41 +02:00
parent 241ed34a2c
commit b6e987dc37
2 changed files with 9 additions and 12 deletions

View File

@ -1969,12 +1969,13 @@ function filter_nat_rules_generate() {
$natrules .= "\n# Reflection redirects and NAT for 1:1 mappings\n" . $reflection_txt;
// Check if inetd is running, if not start it. If so, restart it gracefully.
$helpers = isvalidproc("inetd");
if(file_exists("/var/etc/inetd.conf")) {
if(!$helpers)
$helpers = is_process_running('inetd');
if (file_exists('/var/etc/inetd.conf')) {
if (!$helpers) {
mwexec("/usr/sbin/inetd -wW -R 0 -a 127.0.0.1 /var/etc/inetd.conf");
else
} else {
sigkillbypid("/var/run/inetd.pid", "HUP");
}
}
return $natrules;

View File

@ -39,17 +39,13 @@ function isvalidpid($pidfile) {
return false;
}
function is_process_running($process) {
$output = "";
exec("/bin/pgrep -anx " . escapeshellarg($process), $output, $retval);
function is_process_running($process)
{
exec('/bin/pgrep -anx ' . escapeshellarg($process), $output, $retval);
return (intval($retval) == 0);
}
function isvalidproc($proc) {
return is_process_running($proc);
}
/* sigkill a process by pid file */
/* return 1 for success and 0 for a failure */
function sigkillbypid($pidfile, $sig) {
@ -62,7 +58,7 @@ function sigkillbypid($pidfile, $sig) {
/* kill a process by name */
function killbyname($procname)
{
if (isvalidproc($procname)) {
if (is_process_running($procname)) {
mwexec('/usr/bin/killall ' . escapeshellarg($procname));
}
}