in reply to Shuting down servers

Thanks Mr. Roboticus i am sorry for the minimal information provided. I am using a window machine from that machine i need to login a linux based interface OA through ssh where i need to shutdown all servers at once. Instead of doing one by one which is time consuming.<\P> I tried using <code> @server = (1 .. 5); foreach (@servers) { exec ("poweroff server $_"); } <\code>

Since I doesn't want the status of the command output for poweroff so used exec command. Is this info enough for you? Thanks in advance. <\p>

Replies are listed 'Best First'.
Re^2: Shuting down servers
by jethro (Monsignor) on Mar 15, 2011 at 12:10 UTC

    exec is not the right function as it replaces your script with the command, i.e. the call to exec will always be the last thing your script will do.

    Use system() instead. And try either "poweroff server $_ &" or "nohup poweroff server $_ &", this might already be all you need to do to make it work

    PS: Use </code> instead of <\code>