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

Ads
 

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

Ads









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 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 of code
need of code  howto convert greyscale image to binary image in java
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
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 '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
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
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
Cheap Web Hosting Services in Delhi
web hosting services on Windows, Linux and Dedicated web servers at cheaper... of ?best services in cheaper prices'. Check http://www.roseindiahosting.com... Cheap Web Hosting Services in Delhi Roseindia Technologies Private
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
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 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
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 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
Sitemap Linux Tutorial
| Site Map | Business Software Services India Linux Tutorial Section... | Linux Vs. Windows (A Comparison) | Linux Distributions | Running from CDs... | Installing Linux and Windows (Dual Installation) | Getting Started in Linux
Sample\Practice project on JSP and Web services
Sample\Practice project on JSP and Web services   I wanted to implement\Practice a project using web services. where can I get these details   Please visit the following link: http://www.roseindia.net/webservices
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
i need a java code for finding typemismatch in an editor.
i need a java code for finding typemismatch in an editor.  hi im sriram, i need a java code in such a way that typemismatch code is embedded with the simple java editor. the sample output is shown below !alt text
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
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 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

Ads