plink shutdown

Hi,

I'm testing out this plink script - which will be executed to shutdown multiple LPARs.

This consists from:

plink -i /path/ssh/cert/ root@host shutdown -F
plink -i /path/ssh/cert/ [EMAIL="root@host2"]root@host2[/EMAIL] shutdown -F

The commands gets executed, however it stops on one host, and does not move on to the second host.

any ideas?

Maybe the plink locks up if the remote end shuts down in mid session. Send it to the background?

plink -i /path/ssh/cert/ root@host shutdown -F & pids=$!
plink -i /path/ssh/cert/ root@host2 shutdown -F & pids="$pids $!"
 .
 .
 .
sleep 300 # enough, too much ?
kill -9 $pids

hmm, interesting

I will give it a try.

I've tried plink's -batch and -N however no success... but i will try this suggestion.

Thanks!

rsh/ssh and probably plink are not nice if you want to spin something off, staying by their children despite most options, and in this case, the children evaporate!

I do need plink, to automate a UPS shutdown script...

any other suggestions maybe?

Wrapper the remote shutdown in a script to have it kill its parents (daemonize), something like this, so the plink ends immediately and the script runs on nohup background:

plink -i /path/ssh/cert/ root@host nohup ksh -c '"(kill -9 $PPID $$ ; sleep 5 ; shutdown -F )&"'

Try running it with an "at" command like this:

plink -i /path/ssh/cert/ root@host "echo \"shutdown -F\" | at now"

This will run in the back ground and go through all your servers without waiting for each one to complete. You'll need to backslash the double-quotes inside the double-quotes so they get sent to the other box as regular double-quotes instead of being interrepted by your local shell.