|
From: Mark L. <mid...@ve...> - 2007-09-12 01:01:13
|
I'm using Runtime.exec() Java method to execute the Unix script that was
re-named to the name of my app. Thus I use
String[] cmd = new String[]{myPath + "/myAppName" ,"status"};
Process process = Runtime.getRuntime().exec(cmd);
I can capture the standard output from process, and get a verbal
description of the status of the service. However I'd prefer to get an
integer or byte status, the way it works with Windows (executing
wrapper.exe, not the script). So instead of capturing standard out from
the Process created by exec(), I use
int result = process.waitFor();
When I do this, result = 1 if the service is not running, 0 if the
service is running. (If I get the status of executing "wrapper -qs
../conf/wrapper.conf" as with Windows, I get result = 1 no matter if the
service is up or down.) I don't see this status result documented
anywhere for the Unix script. Is this behavior I can rely on, or should
I parse the standard output from process to determine the status of the
service? I'm trying to avoid the latter, because I'm having trouble
processing the standard output from process when I invoke exec() from
the Event Dispatch Thread, which I need to do.
-Mark
|