use Proc::ProcessTable;

unless (&check_proc('java -server -Djava_app1','3000')) {
	logit('JAVA APP 1 Offline OLY monitor should return false');
	exit 100;
}

sub check_proc {
	my ($proc,$uid) = @_;
	my $pid;
	my $t = new Proc::ProcessTable;
	foreach my $p ( @{$t->table} ){
		unless($p->cmndline =~ /\b$proc\b/ && $p->uid =~ /$uid/) {
			next;
		}
		$pid = $p->pid;
		debug($proc,'OK');
	}

	unless ($pid) {
		debug($proc,'DOWN');
		return 0;
	}
}
