This post is more than 5 years old
2 Intern
•
309 Posts
0
1998
January 25th, 2015 08:00
Halt a VNX5300 via remote CLI/Powershell
Hello,
I have a need to halt a VNX5300 with a Powershell script. I am attempting to use PLINK to ssh into the box and run nas_checkup then nas_halt. Running the checkup script works find but the nas_halt script hangs PLINK. The problem is the VNX goes off the air and hangs PLINK so I don't get the nas_halt output because I don't get control back to my script. I also looked at the EMC Storage Integrator utility but I don't see a Powershell cmdlet to halt the system.
Here is the PLINK command I'm trying to use for nas_halt. I don't hit the "Write-Output" line unless I CTRL-C the script.
$Result = ""
$Result = (.\plink.exe -batch -ssh $VNXDeviceInfo.DeviceName -l $VNXUsername -i $KeyFile "/nasmcd/sbin/nas_halt -f -sp now 2>&1")
Write-Output $Result >> $Logfile
Does anybody have a good way to remotely, programmatically halt the VNX?



Rainer_EMC
4 Operator
•
8.6K Posts
0
January 27th, 2015 10:00
It its just that – then why not start the halt in the background and exit ?
brettesinclair
2 Intern
•
715 Posts
0
January 26th, 2015 01:00
I've only ever done it interactively, but I think nas_halt requires a "yes" confirmation input.
You could try to input "yes" via pipeline, but I can't be sure (not easy to test);
"yes | /nascmd/sbin/nas_halt -f -sp -now"
DanPJ
2 Intern
•
309 Posts
0
January 26th, 2015 06:00
It doesn't prompt when using the "-f" parameter.
brettesinclair
2 Intern
•
715 Posts
0
January 26th, 2015 13:00
Oh derp, I should've seen that
sorry..
Can you try with a simpler syntax for the log, something like;
$Logfile = "c:\scripts\halt.log"
.\plink.exe -batch -ssh $VNXDeviceInfo.DeviceName -l $VNXUsername -i $KeyFile "/nasmcd/sbin/nas_halt -f -sp now" > $Logfile
DanPJ
2 Intern
•
309 Posts
0
January 27th, 2015 09:00
I could try that the next time I need to halt a VNX, which should be soon. I need to collect the output from the plink command though. I suppose I can read the contents of the log instead of collection to a variable at run time. I have a feeling I somehow need plink to return when the VNX falls asleep. I think that's the real issue.
DanPJ
2 Intern
•
309 Posts
0
January 27th, 2015 14:00
I need to trap the output. I need to see if the VNX came down correctly. If I set the process to the background with a "&", then plink will return immediately without providing me any text from the command. I need to see the last bit of text, I'm looking for the "shutdownsp" line.
Sep 6 05:37:28 dlst30em mcd_helper: Shutting down B_APM00114900066 ...
Sep 6 05:37:41 dlst30em mcd_helper: Navicli shutdownpeersp returned SUCCESS
Sep 6 05:38:41 dlst30em mcd_helper: B_APM00114900066 is inaccessible and probably down
Sep 6 05:39:41 dlst30em mcd_helper: Shutting down A_APM00114900066 ...
Sep 6 05:39:42 dlst30em mcd_helper: Navicli shutdownsp returned SUCCESS
I believe If I could control the timeout of plink, I'm home free. I know this because if I hit control-c after I know the vnx is down, I get the text back to my script. I'm search the web but not finding much on this timeout thing. I figured someone on this forum must have done this type of thing before. It's driving me cccrrraaazzzyyy!