Remotely shutdown multiple PCs via script

Doug Kuvaas doug.kuvaas at gmail.com
Fri Dec 9 18:47:02 UTC 2011


Here is what I am trying to do:

>From a central server running HP-UX, I would like to shutdown multiple
Fedora PCs using a script.  This in itself is not a problem.  I have an
account on the machines added to the sudoers file to allow them to shut
down the systems, and connect to said systems using ssh.  I can get the
systems to shut down remotely using the command ssh -t user at host "sudo
/sbin/shutdown -h now".  If I run the script on the host computer it works
like I would expect.

The problem I am running into is the host computer is typically accessed
through one of the Fedora PCs being used to shut it down.  So when I run
the script, it gets to the point where it is telling the current computer
to shutdown, the script is terminated and no further systems shut down.

I have tried changing the command to the following:

ssh -t user at host "sudo /sbin/shutdown -h +1"  but the script wants to wait
for the shutdown command to complete, which takes a minute.

ssh -t user at host "nohup sudo /sbin/shutdown -h now&" but the command seems
to never even run (there is no nohup.out file generated)

ssh -t user at host "echo 'sudo /sbin/shutdown -h now' | at now + 1 minute"
 but the command never seems to run

I have made another script on the target PCs that merely consists of a
sleep command followed by the shutdown command and tried the above with the
same result.  I have also tried using screen but again it seems like it
doesn't work properly.

Anyone have any ideas?

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.fedoraproject.org/pipermail/users/attachments/20111209/bacca47c/attachment.html 


More information about the users mailing list