plink shutdown


Thread Tools Search this Thread
# 1  
Old 03-15-2011
plink shutdown


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/ root@host2 shutdown -F

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

any ideas?
# 2  
Old 03-15-2011
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

# 3  
Old 03-15-2011
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.

# 4  
Old 03-15-2011
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!
# 5  
Old 03-15-2011
I do need plink, to automate a UPS shutdown script...

any other suggestions maybe?
# 6  
Old 03-17-2011
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 )&"'

# 7  
Old 03-17-2011
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.

Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Plink is not working NP1 Windows & DOS: Issues & Discussions 2 10-17-2017 12:29 PM
Plink wait problem zaainabbas Windows & DOS: Issues & Discussions 7 08-02-2017 01:54 PM
How to run UNIX alias from plink? Ivanhou8219 Windows & DOS: Issues & Discussions 1 03-14-2017 07:50 AM
Plink issue in windows nirjhar17 Windows & DOS: Issues & Discussions 6 10-14-2016 05:43 AM
Using plink with sudo access snsuresh Shell Programming and Scripting 0 02-05-2015 12:17 AM
Execute Shell script via Plink lingu85 Shell Programming and Scripting 5 08-11-2014 03:58 PM
Need help on Plink cskumar Shell Programming and Scripting 0 01-31-2014 01:12 PM
PLINK help smitra Shell Programming and Scripting 5 09-03-2012 06:09 AM
plink truncating commands PhilHibbs Shell Programming and Scripting 6 11-07-2011 12:20 PM
Putty / Plink help Greystone Shell Programming and Scripting 6 09-07-2010 07:38 AM
Script to force Oracle database shutdown when shutdown immediate does not work aixhp UNIX for Dummies Questions & Answers 7 03-11-2010 02:04 PM
Error with Plink plasmalightwave Shell Programming and Scripting 1 10-26-2009 08:50 AM
Cannot retreive correct $PATH using PLINK Peuj UNIX for Dummies Questions & Answers 2 03-12-2009 08:01 AM
plink and shell script praveen.1 Shell Programming and Scripting 5 09-08-2008 03:07 PM
How we can use plink? shekhar_ssm Shell Programming and Scripting 0 03-16-2008 01:35 PM