Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#242839 - 29/11/2004 17:59 Starting and stopping Windows services from Unix
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
Windows's NET START and STOP commands can be directed to another computer, so that I can shut down services on one machine without having to log into it directly.

Is there any utility under Unix that anyone knows of that would allow me to do the same thing -- that is, shutdown and restart a Windows service on an (obviously) remote computer.
_________________________
Bitt Faulk

Top
#242840 - 29/11/2004 19:25 Re: Starting and stopping Windows services from Unix [Re: wfaulk]
andy
carpal tunnel

Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
One way is to install sshd on the Windows box, then you can ssh in and run any command line tools you like.

It can be a pig to get sshd installed on Windows, I think I used this http://sshwindows.sourceforge.net/ installer in the end on my Windows server.

Edit: How annoying. Just checked out the "net" command via ssh on my Windows box. While running "net" commands do work, you don't get to see the output of the command. It must be doing something non-standard to output its text.

Typical...


Edited by andy (29/11/2004 19:30)
_________________________
Remind me to change my signature to something more interesting someday

Top
#242841 - 29/11/2004 19:33 Re: Starting and stopping Windows services from Unix [Re: andy]
andy
carpal tunnel

Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
Doing some googling seems to indicate this net.exe problem is specific to some versions of the cygwin dll.
_________________________
Remind me to change my signature to something more interesting someday

Top
#242842 - 29/11/2004 19:45 Re: Starting and stopping Windows services from Unix [Re: andy]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
Yeah, I thought of that way, and I don't like that way. Windows already has RPC commands to do exactly what I want; I should be able to use them directly.

Also, it seems that NET START doesn't work remotely. You have to use a command called SC to start services remotely. I think it's part of the Resource Kit.
_________________________
Bitt Faulk

Top
#242843 - 29/11/2004 19:46 Re: Starting and stopping Windows services from Unix [Re: wfaulk]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
Interesting, I have been using NETSVC from the resource kit, I hadn't heard about SC.
_________________________
Tony Fabris

Top
#242844 - 29/11/2004 20:08 Re: Starting and stopping Windows services from Unix [Re: wfaulk]
PaulWay
addict

Registered: 03/08/1999
Posts: 451
Loc: Canberra, Australia
Thinks: The Perl Win32:: modules have code in them to start and stop services. I'd have to look through them to be sure, but I'd imagine there's a facility in there to be able to specify which machine you wanted to perform this on (not just local). And I'm pretty sure they're portable to non-Win32 systems. Have a look at those...

I suppose they might rely on running on a Windows machine in order to access the Win32 API. Maybe the details of the Win32 RPC protocol hasn't been fully reverse engineered^dbdbscrutinised. Maybe the Perl modules are just front-ends to binary backends which can only run on a Win32 machine. None of these would surprise me given Microsoft's stinginess with publishing standards (and record for disobeying its own). So it's probably 50/50.

Just a thought,

Paul
_________________________
Owner of Mark I empeg 00061, now better than ever - (Thanks, Rod!) - and Karma 3930000004550

Top
#242845 - 29/11/2004 20:10 Re: Starting and stopping Windows services from Unix [Re: PaulWay]
andy
carpal tunnel

Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
It looks like using RPC from Linux to Windows is in theory possible:

http://blogs.cocoondev.org/michaelm/archives/002118.html

Can't find and examples of an implementation though.
_________________________
Remind me to change my signature to something more interesting someday

Top
#242846 - 29/11/2004 20:17 Re: Starting and stopping Windows services from Unix [Re: PaulWay]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
Yeah. Win32:Services, apparently. Won't even begin to install on my Solaris machine. Looks like it depends on some Win32 stuff that would be built into the base Perl.
_________________________
Bitt Faulk

Top
#242847 - 29/11/2004 21:11 Re: Starting and stopping Windows services from Unix [Re: wfaulk]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
It looks like Samba's rpcclient program almost does what I want (in that it seems to deal with the same sorts of remote things), except that (1) it doesn't seem to do exactly what I want, and (2) doesn't seem to actually work in doing the things it claims to do.
_________________________
Bitt Faulk

Top
#242848 - 30/11/2004 06:59 Re: Starting and stopping Windows services from Unix [Re: wfaulk]
andy
carpal tunnel

Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
I found the same problem when I tried playing with it last night.
_________________________
Remind me to change my signature to something more interesting someday

Top