Need Sample code To check the Windows services status is up or down in Linux mechine

Need Sample code To check the Windows services status is up or down in Linux mechine

Hi, I did code to check the windows services are up or down that could be worked in only windows box,but my requirement is windows services is up or down ,this has to check that in linux with simple standlon java application please provide any sample code. below code can work in only windows box but i want to test that windows servises is up or down please provide solution

import java.util.*;
import java.sql.*;
import java.io.*;
import java.text.*;
public class doscmd 
 { 
    public static void main(String args[]) 
      { 
        try 
         { 
           Process p=Runtime.getRuntime().exec("sc query browser"); 

BufferedReader reader=new BufferedReader(new InputStreamReader(p.getInputStream())); 

           String line=reader.readLine();
           while(line!=null) 
            { 
              if(line.trim().startsWith("STATE"))

               {

                if (line.trim().substring(line.trim().indexOf(":")+1,line.trim().indexOf(":")+4).trim().equals("1"))
    System.out.println("Stopped");
else
    if (line.trim().substring(line.trim().indexOf(":")+1,line.trim().indexOf(":")+4).trim().equals("2"))
        System.out.println("Startting....");
    else
        if (line.trim().substring(line.trim().indexOf(":")+1,line.trim().indexOf(":")+4).trim().equals("3"))
            System.out.println("Stopping....");
        else
            if (line.trim().substring(line.trim().indexOf(":")+1,line.trim().indexOf(":")+4).trim().equals("4"))
                System.out.println("Running");

  }
   line=reader.readLine(); 
   } 

 } 

 catch(IOException e1) { } 



   } 
 } 
View Answers









Related Tutorials/Questions & Answers:
Need Sample code To check the Windows services status is up or down in Linux mechine
Need Sample code To check the Windows services status is up or down in Linux mechine  Hi, I did code to check the windows services are up or down... is up or down ,this has to check that in linux with simple standlon java
Need sample code
Need sample code  Need code for graph which shows the performance comparission of aprior algorithm and coherent rule algorithm.plz can any one help me i need in a week
Advertisements
need a Sample code - Development process
need a Sample code  i want run the python script in java code by using Runtime class and output should be formed like XML format.please help me. Advanced Thanks, Krishna
Need simple java code to start and stop the remote windows service.
Need simple java code to start and stop the remote windows service.  Hi, I Need simple java code to start and stop the remote windows service. Example:There are two servers 1) Server A and 2) Server B. If a notepad.exe file
Need someone to check and modify my simple code - Java Beginners
Need someone to check and modify my simple code   How to write a class that contains Variables that hold hourly rate of pay, number of hours...); } }   Hi Friend, You can use following code: import
Linux Vs. Windows
Linux Vs. Windows       ...;       Both Linux and Windows works... the version or distribution of   the software. Both Windows and Linux have
need of code
need of code  howto convert greyscale image to binary image in java
need help for writting code in struts action class for check boxes and radio buttons - Struts
need help for writting code in struts action class for check boxes and radio buttons  Hello frnds, i need help from u esteemed and talented people.iwould like to write code in struts action class for check boxes and radio
need code
need code  Create Vehicle having following attributes: Vehicle No., Model, Manufacturer and Color. Create truck which has the following additional... is the required code: import java.util.*; class Vehicle { int
need code
need code  Create Vehicle having following attributes: Vehicle No., Model, Manufacturer and Color. Create truck which has the following additional... is the required code: import java.util.*; class Vehicle { int
need code
need code  Create Vehicle having following attributes: Vehicle No., Model, Manufacturer and Color. Create truck which has the following additional... is the required code: import java.util.*; class Vehicle { int
ModuleNotFoundError: No module named 'check_email_status'
ModuleNotFoundError: No module named 'check_email_status'  Hi, My... named 'check_email_status' How to remove the ModuleNotFoundError: No module named 'check_email_status' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'check_email_status'
ModuleNotFoundError: No module named 'check_email_status'  Hi, My... named 'check_email_status' How to remove the ModuleNotFoundError: No module named 'check_email_status' error? Thanks   Hi, In your
How to check if ZooKeeper is running or up from command prompt
How to check if ZooKeeper is running or up from command prompt  Hi... to check if ZooKeeper is running or up from command prompt? Thanks   Hi, to know the status any of the following command can be used: jps -l | grep
Cheap Web Hosting Services in India
Limited (RTPL) provides the best web hosting services on Windows, Linux.... The need of the cheap web hosting services requires those want some specific, concise.... To meet the need of clients, Roseindia provides cheaper web hosting services
how to check the size of a tar file in linux
how to check the size of a tar file in linux  Hi, I want to check the size of tar file in Linux. How to check the size of a tar file in linux? What Linux command I should use to check the size of a tar file? Thanks
linux desktop on windows without using vn or any other ? - Java Magazine
linux desktop on windows without using vn or any other ?  linux desktop on windows without using vn or any other ?. I have a linux pc and windows xp pc but i am not able to connect the linux pc on windows .why? .windows
ModuleNotFoundError: No module named 'aws-services-status'
ModuleNotFoundError: No module named 'aws-services-status'  Hi, My... named 'aws-services-status' How to remove the ModuleNotFoundError: No module named 'aws-services-status' error? Thanks   Hi
ModuleNotFoundError: No module named 'aws-services-status'
ModuleNotFoundError: No module named 'aws-services-status'  Hi, My... named 'aws-services-status' How to remove the ModuleNotFoundError: No module named 'aws-services-status' error? Thanks   Hi
need JSP Code.
need JSP Code.  **Hi I need JSP code for selling Products which are in Database. Please can any one help for this.URGENT... Thank You..! Abhijeet
Need a JSP CODE
Need a JSP CODE  *Hi I need JSP source code for selling products which are in database.. please can any one help me ..URGENT* Thank You
What is Linux Hosting?
and cloud services. Presently along with Windows hosting services Linux hosting... software that can be accessed by any web developer and services. Linux... services. Before going on the various pros and cons concerning Linux hosting, let
Need an example of basic code.
Need an example of basic code.   Im working on an art project that I want to use some code in, and I am proficient in python but that looks fairly simple so I was hoping java would look more impressive. So I just need a visual
Need an example of basic code.
Need an example of basic code.   Im working on an art project that I want to use some code in, and I am proficient in python but that looks fairly simple so I was hoping java would look more impressive. So I just need a visual
Need an example of basic code.
Need an example of basic code.   Im working on an art project that I want to use some code in, and I am proficient in python but that looks fairly simple so I was hoping java would look more impressive. So I just need a visual
need code - Java Beginners
need code   i want to take the html coding. if user give a input html file the out is html coding in text file. i want to take html coding only... are sending you a sample code which will be helpful to you. import java.io.
check youtube iframe code
check youtube iframe code  I have a piece of code that checks the youtube embed code in this format: My PHP code looks like this now: //Check Embed Code $embedCode = $postData['embedCode
Sample Ajax Code
Sample Ajax Code  Sample Ajax Code for getting values from another JSP   The below code is helpful to access another Action class...;/SIX> <SEVEN><%= request.getAttribute("STATUS")%></SEVEN>
need code for file browser
need code for file browser  hi, i need to write a code to browse the file in my computer using Jsp or java.. what is the code for file browser?   JSP Code for browsing: 1)page.jsp: <%@ page language="java" %>
Need a jsp code
Need a jsp code  I need a jsp code in which when i select a value.....please help me for this.   The given code retrieves the employee name...)For the above code, we have created following table: CREATE TABLE `employee
ModuleNotFoundError: No module named 'http-status-code'
ModuleNotFoundError: No module named 'http-status-code'  Hi, My... named 'http-status-code' How to remove the ModuleNotFoundError: No module named 'http-status-code' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'http-status-code'
ModuleNotFoundError: No module named 'http-status-code'  Hi, My... named 'http-status-code' How to remove the ModuleNotFoundError: No module named 'http-status-code' error? Thanks   Hi, In your
Sample Code - Development process
Sample Code   Hi Friend, Give sample code DTO... is generic enough to use for any DTO purpose; therefore, you do not need to design a new class for each DTO. 2.Write or generate the code for the data transfer
code need - Java Beginners
code need  hi i want to code doing for this. If i have enter the text file in my java project. example input is 1,2,3,4,5(it is in input text file...)  Hi Friend, Try the following code. We hope this will help you
sample code - WebSevices
sample code  Hi Guys, can any body tell me use of webservices ? I want a sample code using xml with one application server bea weblogic and webserver tomcat   Hi Friend, Please visit the following link
Cheap Web Hosting Services in Delhi
web hosting services on Windows, Linux and Dedicated web servers at cheaper... because we believe in mantra of ?best services in cheaper prices'. Check http... Cheap Web Hosting Services in Delhi Roseindia Technologies Private
Sitemap Linux Tutorial
| Site Map | Business Software Services India Linux Tutorial Section...; | Linux in Internet | Linux Vs. Windows (A Comparison) | Linux Distributions... Process | Installing Linux and Windows (Dual Installation) | Getting
I need to launch multiple instances of IE browser from one windows M/C on the another windows M/C
I need to launch multiple instances of IE browser from one windows M/C on the another windows M/C  multiple instances of IE browser from one windows M/C on the another windows M/C
Need source code - Swing AWT
Need source code  Hai, I need a source code for developing the project, title is "Face Recognition" and the backend as My-sql.... Thanks & Regards
need code for login in asp.net with c#
need code for login in asp.net with c#  hai iam trying to develop a project in asp.net with c#,so i need a code for login page using which admin and other users can log in.plz help me, thanks in advance
need java code - Java Beginners
need java code  I want java code for connect to bit.ly and our link is converted into shorten link and give me response. as a converted link
NEED CODE FOR APPLICATION - Development process
NEED CODE FOR APPLICATION  i want to build a supermarket software that has the features of stock taking and receipt priting. can u help me
Need source code - Swing AWT
Need source code  Hai, I need a idea and code for developing the project "Face Recognition" with the backend as My-sql.... Thanks & Regards
Dependant & dynamic drop down list - Follow up
Dependant & dynamic drop down list - Follow up  Thanks for your... down. In my case user can choose more than one row , which is then sent to next...){ System.out.println(e); } %> For the above code, we have created two database tables
Need the Following MobileApplication Related Code
Need the Following MobileApplication Related Code  Hi, I need java...: and one Daemon Thread class need's to run while doing the above operations and if you can provide code in switch cases,I feel more happy. Please reply me ASAP.ADS
I need to launch multiple browsers installed on another windows M/C from my windows M/C over the network.
I need to launch multiple browsers installed on another windows M/C from my windows M/C over the network.  Please share the java code for the same as soon as possible
need someone to do/help with code
need someone to do/help with code  i need someone to do a code for me. It is a restaurant menu that displays a list of 10 food items. A customer..., along with the number of items sold..please help did a code 500 times cant
i need program or code for this program
i need program or code for this program  out should be in this form 1 2 3 4 5 6 3 5 7 9 11 8 12 16 20 20 28 36 48 64 112
java sample code - Java Beginners
java sample code  hai...... i need a full sample program fo inheritance.........  Hi Friend, Please visit the following link: http://www.roseindia.net/java/language/inheritance.shtml Thanks
Need Java Source Code - JDBC
Need Java Source Code  I have a textfield for EmployeeId in which the Id, for eg: "E001" has to be generated automatically when ever i click... be implemented.  Hi friend, Please send me code because your posted

Ads