blackadder has asked for the wisdom of the Perl Monks concerning the following question:

Dear Holy ones, Greetings

I am calling a software installation program from within my Perl script using the system command. However, this installation program automatically reboots the workstation at the end of its execution. My question is how can over ride this system shut down that the installation program issues from my Perl script.

thanks.

Replies are listed 'Best First'.
Re: Over ridding a shutdown command.
by maa (Pilgrim) on May 13, 2004 at 13:54 UTC
    shutdown.exe /A

    You didn't tell us what O/S you're using so I have assumed it's Windows. The shutdown exe is in the NTReskit so I assume it's available in the other Reskits, too...

    I also assume that you can do it using the Win32 API but I don't know how off-hand.

    Win32::AbortSystemShutdown(MACHINE) [EXT] Aborts a system shutdown (started by the InitiateSystemShutdown function) on the specified MACHINE.
    perldoc -f Win32
      THANKS,...both worked...and it was very easy.

      I need to retain my confidence with my PERL skills....LOL

      Blackadder
      Very Sorry, the desk Top OS is Windows XP

      Cheers
Re: Over ridding a shutdown command.
by tye (Sage) on May 13, 2004 at 14:42 UTC

    If you "use Win32" then you can call Win32::AbortSystemShutdown(). You can also "use Win32API::Registry qw( AbortSystemShutdown )" which has the advantage of exporting the function so you don't have to type "Win32::" each time and actually including documentation for the call.

    Update: "perldoc Win32" finds the documentation (in perl/lib/pod/win32.pod) but I didn't find it in Win32.pm.

    - tye        

Re: Over ridding a shutdown command.
by muntfish (Chaplain) on May 13, 2004 at 13:51 UTC

    I might be missing the point here, but I don't think that's a question I can answer without knowing what OS you are using. Would you care to tell us?

    I imagine it is unlikely that this is possible in Unix/Linux. There might be a slim chance you could do it in Windows NT/2K/XP.

    But any solution is not going to be Perl related, so you might be better off going to a web site related to your particular OS.

      Not that it's germaine to the original questioner or has anything to do with Perl, but if you use shutdown with a delay you can kill the shutdown process before the countdown is finished and the box shouldn't reboot.