Remotely shutdown multiple PCs via script

suvayu ali fatkasuvayu+linux at gmail.com
Sat Dec 10 02:58:43 UTC 2011


On Fri, Dec 9, 2011 at 23:06, Doug Kuvaas <doug.kuvaas at gmail.com> wrote:
> I have actually tried ssh -t user at host "nohup /path/to/shutdownscript &" and
> it seemed to be doing the same thing....waiting for the shutdownscript to
> finish before moving to the next line.    I was expecting the nohup
> <command> & to immediately return back to the script and not wait for the
> command to complete.
>
> I seem to have it figured out now though.  I should have been using ssh -f
> instead of ssh -t for my script.  I also changed the nohup command so that
> it redirects all output to /dev/null.  That fixed the command not returning
> to the script issue that I was seeing.
>
> I also discovered that I forgot to turn of the RequireTTY default for
> sudoers, which was causing the script to work perfectly when I ran it
> locally on the machines, but when trying to call the scripts remotely made
> them appear to not run at all...they were running, the sudo command was just
> refusing to run without a controlling terminal.

I don't follow why all this fuss when you can simply run a screen
session on the server and it would be as if you are logged the whole
time without any interruption!

-- 
Suvayu

Open source is the future. It sets us free.


More information about the users mailing list