Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Need Sample code To check the Windows services status is up or down in Linux mechine

Have Programming Question? Ask it here!
 
 
 


manjula
Need Sample code To check the Windows services status is up or down in Linux mechine
0 Answer(s)      10 months ago
Posted in : Java Beginners


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) { } 



   } 
 } 

Advertisement
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
no licensing fee, whereas Windows must need license.  Linux can be operated on older... Linux Vs. Windows       ...;       Both Linux and Windows works
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")%><
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
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
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
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
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
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
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
Sample Code For ArrayLlist - Java Beginners
Sample Code For ArrayLlist   Hi Friend, I want sample code for adding single records and multiple records using ArrayList.Give sample code for Arraylist with realtime application.  Hi I
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
need of code
need of code  howto convert greyscale image to binary image in java
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
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
Sample Code for DTO in WebApplication - Development process
Sample Code for DTO in WebApplication   Hi Friends, Can u explain DTO in webapplication with sample code
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
Navigate database values using up and down key of keyboard
Navigate database values using up and down key of keyboard In this section, you will learn how to navigate database values using up and down keys... the database values. On pressing the up key, the following code will fetch one by one
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 a sample project using java technologies like jsp, servlets, struts
need a sample project using java technologies like jsp, servlets, struts  Hi everybody! I have learnt core java,jdbc,jsp,servlets & struts. Please guide me where can i find sample project like library management, CMS or any
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
Hibernate sample code - Hibernate Interview Questions
Hibernate sample code  Hi Can any body tell me how to persist inner class,abstract class,final class,and interface in hibernate. From... Hibernet.org.The Hibernate 3.0 core is 68,549 lines of Java code together with 27,948 lines
dojo check tree code - Ajax
dojo check tree code  Hi..Boss Thanks for ur site. it helped me so many times.. my problem is while trying to use dojo tree with check boxes facing some issues i tried with two examples but i failed to do that http
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.
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 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
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
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
Sample code for An ASCII Encryption and Decryption code in C-language only.
Sample code for An ASCII Encryption and Decryption code in C-language only.  In an environment where security is paramount, the messages stored... code for this project including both the encryption and decryption aspects
server status
server status   How to check the apache server status in unix machine
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
What is Windows Hosting?
hosting need Windows hosting packages can actually be a little costlier than Linux... of a choice as there are only two major hosting types, Windows hosting and Linux... one is the better, Linux or Windows. Though both types of hosting has its
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
Web Hosting Services India
a reliable, quick, and most affordable web hosting services on linux and Windows... on Linux Server to Dedicated Hosting on Windows Server, as per the requirement... of Web Hosting Services and you must have different kinds of experiences
jsp login code ... when username , drop down box and password is correct
jsp login code ... when username , drop down box and password is correct  i need a jsp code for login.... when username password and dropdown box value is correct.... the drop down box values should be retrieved from database
How to use Bean Area in Oracle Forms 9i with Sample code ?
How to use Bean Area in Oracle Forms 9i with Sample code ?  Hi friend.I posted a query,but I didn't get the answer for it.Help me to resolve including a bean area in oracle forms 9i and using it in forms.Thanks in advance.Help me
What is Linux?
the basic services and device drivers used by all other programs running on a Linux...What is Linux?        ...; Linux is a free Unix-type operating system originally developed by Linus
why jsp pages are not working on linux but java application is working in windows - JSP-Servlet
why jsp pages are not working on linux but java application is working in windows  java web application jsp pages are not showing the fileds corectly on linux server but same application is working on windows.why
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
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
Advertisements
 

 

 

DMCA.com