I have had the same issue for several years. I don't know of a Perl solution but there is a system level solution that is simple to implement via perl. You can shell out to windows and use the net stop/net send commands to bring down and bring up the server. The main drawback is that, while you can stop all dependant services with one command, you have to start all the services by hand. I have it set up this way.
my @services = qw(MSSQLServerOLAPService SQLServerAgent MSSQLSERVER + ) foreach (@services){ my $rtncd = system("net stop $_") >> 8; # some error checking & other code if wanted } foreach (reverse @services){ my $rtncd = system("net start $_") >> 8; # some error checking & other code if wanted }

The order of the service shutdown and startup is based on the order of ops I have observed on my system. I've occasionally thought of exploring Win32::API to see if I could access the restart option that way but I haven't found the time yet and this solution has worked solidly for many years.

Hope this helps.

PJ
use strict; use warnings; use diagnostics;

In reply to Re: Win32 - Dependant services by periapt
in thread Win32 - Dependant services by Smaug

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.