Private
Server IP : 195.201.23.43  /  Your IP : 3.133.106.74
Web Server : Apache
System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64
User : kdecoratie ( 1041)
PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/webmin/status/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /usr/share/webmin/status/proc-monitor.pl
# proc-monitor.pl
# Check if some process is running

sub get_proc_status
{
local (@found, $count);
return { 'up' => -1 } if (!&foreign_check("proc"));
&foreign_require("proc", "proc-lib.pl");
foreach $p (&foreign_call("proc", "list_processes")) {
	if (eval { $p->{'args'} =~ /$_[0]->{'cmd'}/i } &&
	    (!$_[0]->{'asuser'} || $_[0]->{'asuser'} eq $p->{'user'})) {
		push(@found, $p->{'pid'});
		$count++;
		}
	}
local $thresh = $_[0]->{'thresh'} || 1;
if ($_[0]->{'not'}) {
	if ($count >= $thresh) {
		return { 'up' => 0, 'value' => $count };
		}
	else {
		return { 'up' => 1, 'value' => $count };
		}
	}
else {
	if ($count >= $thresh) {
		return { 'up' => 1,
			 'desc' => &text('proc_pid', join(" ", @found)),
			 'value' => $count };
		}
	else {
		return { 'up' => 0, 'value' => $count };
		}
	}
}

sub show_proc_dialog
{
print &ui_table_row($text{'proc_cmd'},
	&ui_textbox("cmd", $_[0]->{'cmd'}, 30));

print &ui_table_row($text{'proc_not'},
	&ui_radio("not", int($_[0]->{'not'}),
		  [ [ 0, $text{'proc_not0'} ],
		    [ 1, $text{'proc_not1'} ] ]));

print &ui_table_row($text{'proc_thresh'},
	&ui_textbox("thresh", $_[0]->{'thresh'} || 1, 5));

print &ui_table_row($text{'proc_asuser'},
	&ui_opt_textbox("asuser", $_[0]->{'asuser'}, 13,
			$text{'proc_anyuser'})." ".
	&user_chooser_button("asuser"));
}

sub parse_proc_dialog
{
&depends_check($_[0], "proc");
$in{'cmd'} || &error($text{'proc_ecmd'});
$_[0]->{'cmd'} = $in{'cmd'};
$_[0]->{'not'} = $in{'not'};
$in{'thresh'} =~ /^\d+$/ || &error($text{'proc_ethresh'});
$_[0]->{'thresh'} = $in{'thresh'};
if ($in{'asuser_def'}) {
	delete($_[0]->{'asuser'});
	}
else {
	defined(getpwnam($in{'asuser'})) || &error($text{'proc_easuser'});
	$_[0]->{'asuser'} = $in{'asuser'};
	}
}

1;

Private