start-stop windows-nt services in eventhandlers

Stanley Hopcroft Stanley.Hopcroft at IPAustralia.Gov.AU
Fri May 9 11:39:22 CEST 2003


Dear Sir,

I am writing to thank you for your letter and say,


On Fri, May 09, 2003 at 10:22:46AM +0200, Tonny Verhoef wrote:
> Hi,
> 
> I want to create an eventhandler for Nagios (on a FreeBSD system) which will (re-)start the service or process of an windows nt4/2000 box.
> 
> If that requires software on the freebsd box thats Ok, but I don't want to install stuff on the windows boxes. The functionality is there, since you can start/stop services on a windows box from another windows box.
> 
> Any suggestions 

that the samba-tng or samba-3.0 rpcclient may be able to do this.

The samba-tng (2.6, I think but you should get the latest security
release [3.x]) rpcclient man page has this

       Service Control

              These commands provide functionality similar to the
	      Windows  NT Service Control Manager.


       svcenum
              [-i] Lists Services.


       svcinfo
              <service> Service Information


       svcstart
              <service> [arg 0] [arg 1] ... Start Service


       svcstop
              <service> Stop Service

Bravo samba-tng developers !!

Until someone writes a Perl extension (or other language binding) you
will need to write a C plugin/exe to be called from your event handler
to start the svc, or drive rpcclient from the shell (fine but you have
less control).

This (ie svc control) function of rpcclient _may_ exist in Samba 3.0; it
definitely does _not_ in the stable branch 2.2.x. (the 2.2.8 rpcclient
can not start or stop NT services).

Be warned that although a lot of MS PDCs have been replaced by
Samba-tng, I haven't used rpcclient to manage NT services.

Samba-tng builds from source fine on  FreeBSD 4.x-RELEASE.

An alpha samba-HEAD 3.0a2 is in the packages but no -tng port or
package.

Yours sincerely.

-- 
------------------------------------------------------------------------
Stanley Hopcroft
------------------------------------------------------------------------

'...No man is an island, entire of itself; every man is a piece of the
continent, a part of the main. If a clod be washed away by the sea,
Europe is the less, as well as if a promontory were, as well as if a
manor of thy friend's or of thine own were. Any man's death diminishes
me, because I am involved in mankind; and therefore never send to know
for whom the bell tolls; it tolls for thee...'

from Meditation 17, J Donne.


-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com




More information about the Developers mailing list