Refactoring of WANavigation and i,plementation of Service Status
This commit is contained in:
parent
e201f9ce4c
commit
b115a9cb4f
14 changed files with 101 additions and 91 deletions
|
|
@ -35,7 +35,7 @@ import java.util.logging.Logger;
|
|||
|
||||
public class ApacheStatus extends WAServiceStatus {
|
||||
private static final Logger log = LogUtil.getLogger();
|
||||
private static final String PID_FILE = "/var/run/apache2.pid";
|
||||
private static final String PID_FILE_PATH = "/var/run/apache2.pid";
|
||||
|
||||
private static OSAbstractionLayer os = OSAbstractionLayer.getInstance();
|
||||
|
||||
|
|
@ -58,11 +58,14 @@ public class ApacheStatus extends WAServiceStatus {
|
|||
@Override
|
||||
public ServiceStatusType getStatus() {
|
||||
try {
|
||||
int pid = Integer.parseInt(
|
||||
FileUtil.getContent(new File(PID_FILE)));
|
||||
if(Ps.isRunning(pid))
|
||||
return ServiceStatusType.RUNNING;
|
||||
return ServiceStatusType.STOPPED;
|
||||
File pidFile = new File(PID_FILE_PATH);
|
||||
if(pidFile.exists()) {
|
||||
int pid = Integer.parseInt(
|
||||
FileUtil.getContent(pidFile));
|
||||
if (Ps.isRunning(pid))
|
||||
return ServiceStatusType.RUNNING;
|
||||
return ServiceStatusType.STOPPED;
|
||||
}
|
||||
}catch(IOException e){
|
||||
log.log(Level.WARNING, null, e);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue