Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re^2: Win32 - Dependant services

by Smaug (Pilgrim)
on Oct 21, 2004 at 14:34 UTC ( [id://401177] : note . print w/replies, xml ) Need Help??

in reply to Re: Win32 - Dependant services
in thread Win32 - Dependant services

Hi PJ,
Here is a possible solution using your command shell idea and the output from 'net stop'
use strict; my @order; my @results = `net stop mssqlserver /N`; foreach(@results){ if(/^ /){ push(@order,$_) } } foreach(reverse(@order)){ print("Stopping $_\n"); system("net stop \"$_\""); } #...... reverse to start again....

This is an initial hack. Any ideas for improvement are welcome!!

Replies are listed 'Best First'.
Re^3: Win32 - Dependant services
by periapt (Hermit) on Oct 22, 2004 at 16:07 UTC

    Actually, this looks pretty good. I may try it myself. I haven't had the opportunity to take down my server lately so I haven't tested it but I like it.

    use strict; use warnings; use diagnostics;