Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #6246 > unrolled thread
| Started by | Joe Bench <benchjoe@yahoo.de> |
|---|---|
| First post | 2013-11-19 15:47 +0100 |
| Last post | 2013-11-19 13:36 -0800 |
| Articles | 8 — 4 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
Check if service is running Joe Bench <benchjoe@yahoo.de> - 2013-11-19 15:47 +0100
Re: Check if service is running "Uwe Heyer" <uwe.heyer@aristik.de> - 2013-11-19 19:04 +0000
Re: Check if service is running Joe Bench <benchjoe@yahoo.de> - 2013-11-20 08:29 +0100
Re: Check if service is running Karl Faller <mail_withoutthat_@_drei-f_andthat_.de> - 2013-11-20 09:54 +0100
Re: Check if service is running "Uwe Heyer" <uwe.heyer@aristik.de> - 2013-11-20 21:20 +0000
Re: Check if service is running Karl Faller <mail_withoutthat_@_drei-f_andthat_.de> - 2013-11-20 23:02 +0100
Re: Check if service is running Joe Bench <benchjoe@yahoo.de> - 2013-11-21 08:07 +0100
Re: Check if service is running dlzc <dlzc1@cox.net> - 2013-11-19 13:36 -0800
| From | Joe Bench <benchjoe@yahoo.de> |
|---|---|
| Date | 2013-11-19 15:47 +0100 |
| Subject | Check if service is running |
| Message-ID | <528b79ec$0$2349$91cee783@newsreader04.highway.telekom.at> |
Hi there! How can i check if a service on a remote machine is running? I can start a service via script, i can stop it. Great. But the scipts can not give feedback, if the start/stop fails. My client application needs to know, if this service is running or not. Any ideas? kindest regards, Joe
[toc] | [next] | [standalone]
| From | "Uwe Heyer" <uwe.heyer@aristik.de> |
|---|---|
| Date | 2013-11-19 19:04 +0000 |
| Message-ID | <bf1r2nFknomU1@mid.individual.net> |
| In reply to | #6246 |
Joe Bench wrote:
> Hi there!
>
> How can i check if a service on a remote machine is running?
> I can start a service via script, i can stop it. Great.
> But the scipts can not give feedback, if the start/stop fails.
>
> My client application needs to know, if this service is running or
> not.
>
> Any ideas?
>
> kindest regards,
> Joe
Hi Joe,
I can't give you any code sample, you need asking google or MSDN
google for SERVICE_STATUS_PROCESS (== StatusStructure) or may be
defined in VO yet
the short story
hManager := openSCManager(szTarget, Null, SC_MANAGER_ALL_ACCESS)
hService := OpenService(hManger, szServiceName, SERVICE_ALL_ACCESS)
QueryServiceStatusEx(hService,
SC_STATUS_PROCESS_INFO, // get status
@StatusStructure,
_sizeof(SERVICE_STATUS_PROCESS),
@dwBytesNeeded )
? StatusStructure.dwCurrentState // SERVICE_PAUSED == 7
CloseServiceHandle(hService)
CloseServiceHandle(hManager)
you need access rights for szTarget
Ahoj
-Uwe
[toc] | [prev] | [next] | [standalone]
| From | Joe Bench <benchjoe@yahoo.de> |
|---|---|
| Date | 2013-11-20 08:29 +0100 |
| Message-ID | <528c64d6$0$12672$91cee783@newsreader03.highway.telekom.at> |
| In reply to | #6247 |
Hi Uwe, > Hi Joe, > > I can't give you any code sample, you need asking google or MSDN > > google for SERVICE_STATUS_PROCESS (== StatusStructure) or may be > defined in VO yet > > > the short story > hManager := openSCManager(szTarget, Null, SC_MANAGER_ALL_ACCESS) > hService := OpenService(hManger, szServiceName, SERVICE_ALL_ACCESS) > QueryServiceStatusEx(hService, > SC_STATUS_PROCESS_INFO, // get status > @StatusStructure, > _sizeof(SERVICE_STATUS_PROCESS), > @dwBytesNeeded ) > > ? StatusStructure.dwCurrentState // SERVICE_PAUSED == 7 > > CloseServiceHandle(hService) > CloseServiceHandle(hManager) > > > you need access rights for szTarget Where do i get the function QueryServiceStatusEx? Thx and greetings, Joe
[toc] | [prev] | [next] | [standalone]
| From | Karl Faller <mail_withoutthat_@_drei-f_andthat_.de> |
|---|---|
| Date | 2013-11-20 09:54 +0100 |
| Message-ID | <74uo8914oc0jgedns1oc2vp4qcm5jthff4@4ax.com> |
| In reply to | #6249 |
Joe, >Where do i get the function QueryServiceStatusEx? at least QueryServiceStatus is in the Win32 SDK lib of VO... Karl
[toc] | [prev] | [next] | [standalone]
| From | "Uwe Heyer" <uwe.heyer@aristik.de> |
|---|---|
| Date | 2013-11-20 21:20 +0000 |
| Message-ID | <bf4ncbF8pabU1@mid.individual.net> |
| In reply to | #6249 |
Joe Bench wrote:
> Hi Uwe,
>
> > Hi Joe,
> >
> > I can't give you any code sample, you need asking google or MSDN
> >
> > google for SERVICE_STATUS_PROCESS (== StatusStructure) or may be
> > defined in VO yet
> >
> >
> > the short story
> > hManager := openSCManager(szTarget, Null, SC_MANAGER_ALL_ACCESS)
> > hService := OpenService(hManger, szServiceName, SERVICE_ALL_ACCESS)
> > QueryServiceStatusEx(hService,
> > SC_STATUS_PROCESS_INFO, // get status
> > @StatusStructure,
> > _sizeof(SERVICE_STATUS_PROCESS),
> > @dwBytesNeeded )
> >
> > ? StatusStructure.dwCurrentState // SERVICE_PAUSED == 7
> >
> > CloseServiceHandle(hService)
> > CloseServiceHandle(hManager)
> >
> >
> > you need access rights for szTarget
>
> Where do i get the function QueryServiceStatusEx?
>
> Thx and greetings,
> Joe
Hi Joe,
regarding Fred's tip you can use QueryServiceStatus either.
the structure name should be SERVICE_STATUS. In the case it is unknow
for VO use this as template
typedef struct _SERVICE_STATUS
{ DWORD dwServiceType;
DWORD dwCurrentState;
DWORD dwControlsAccepted;
DWORD dwWin32ExitCode;
DWORD dwServiceSpecificExitCode;
DWORD dwCheckPoint;
DWORD dwWaitHint;
} SERVICE_STATUS,
*LPSERVICE_STATUS;
it is a structur with a set of DWORDs only. Align it like other win api
structures (see vo sdk)
The (dwCurrentState) current state of the service. This member can be
one of the following values.
Value Meaning
SERVICE_CONTINUE_PENDING
0x00000005
The service continue is pending.
SERVICE_PAUSE_PENDING
0x00000006
The service pause is pending.
SERVICE_PAUSED
0x00000007
The service is paused.
SERVICE_RUNNING
0x00000004
The service is running.
SERVICE_START_PENDING
0x00000002
The service is starting.
SERVICE_STOP_PENDING
0x00000003
The service is stopping.
SERVICE_STOPPED
0x00000001
The service is not running.
Sorry, I don't own a copy of VO so my help is somewhat imprecive
Ahoj
-Uwe
[toc] | [prev] | [next] | [standalone]
| From | Karl Faller <mail_withoutthat_@_drei-f_andthat_.de> |
|---|---|
| Date | 2013-11-20 23:02 +0100 |
| Message-ID | <o8cq89ps2j5kar88l3hr7v750avh21o5nv@4ax.com> |
| In reply to | #6258 |
Uwe, >the structure name should be SERVICE_STATUS. In the case it is unknow >for VO use this as template Vo knows it, you only have to be aware, that all of this Api types got a "_Win" prefix - so it's: STRUCT _WINSERVICE_STATUS MEMBER dwServiceType AS DWORD MEMBER dwCurrentState AS DWORD MEMBER dwControlsAccepted AS DWORD MEMBER dwWin32ExitCode AS DWORD MEMBER dwServiceSpecificExitCode AS DWORD MEMBER dwCheckPoint AS DWORD MEMBER dwWaitHint AS DWORD HTH Karl
[toc] | [prev] | [next] | [standalone]
| From | Joe Bench <benchjoe@yahoo.de> |
|---|---|
| Date | 2013-11-21 08:07 +0100 |
| Message-ID | <528db12f$0$12672$91cee783@newsreader03.highway.telekom.at> |
| In reply to | #6259 |
Thanx to all writers! ;-) Joe
[toc] | [prev] | [next] | [standalone]
| From | dlzc <dlzc1@cox.net> |
|---|---|
| Date | 2013-11-19 13:36 -0800 |
| Message-ID | <bb442f83-502f-40c6-8abb-de15e06cf1c1@googlegroups.com> |
| In reply to | #6246 |
Dear Joe Bench: On Tuesday, November 19, 2013 7:47:07 AM UTC-7, Joe Bench wrote: ... > I can start a service via script, i can stop > it. Great. > But the scipts can not give feedback, if the > start/stop fails. It depends, on whether you redirect STDOUT, by using >STATUS.txt (or similar), and parse that text file for status. > Any ideas? Parsing output sent to a text file, if this is possible. Get lots of different status, and can add more, but requires scanning the text file. David A. Smith
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web