permaculture playing cards*
The moose likes Java in General and the fly likes Windows and Unix Services status through java code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Windows and Unix Services status through java code" Watch "Windows and Unix Services status through java code" New topic
Author

Windows and Unix Services status through java code

rohi mat
Greenhorn

Joined: Jan 18, 2012
Posts: 1
Hi.. can anybody help me with creating a program that could give me the status of some services running on Remote Windows and Unix servers..?
Thanks a lot !
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19543
    
  16

The right way for Windows services is to a) use JNI to query the remote services, or b) use the "sc" command with Runtime.exec / ProcessBuilder. For Unix I don't think there's a uniform way, as I don't think there's a uniform way to do this on local machines themselves. Often you can use the service script in combination with "status" (e.g. /etc/init.d/sshd status) but the "status" argument may not be supported. Either way, you'd also need to connect to the machine using SSH if available.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36508
    
  16
And welcome to the Ranch
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Windows and Unix Services status through java code
 
Similar Threads
How to set the System variable on WINDOWS and UNIX?
using Runtime.exec() and the process exitValue = 1
check status of web application
check status of web application
UNIX and Windows on the same machine!!