Results 1 to 4 of 4
All Gurus
I am very new to Linux and im trying to setup an automatic shut down for our linux boxes via our UPS (if there’s a power outage). The ...
- 11-24-2008 #1Just Joined!
- Join Date
- Nov 2008
- Posts
- 2
Newbie Linux scripting question
All Gurus
I am very new to Linux and im trying to setup an automatic shut down for our linux boxes via our UPS (if there’s a power outage). The UPS only allows a batch file to be run so ive come up with this idea...
I’ve come across plink to allow me to run the Linux command in a batch file:
plink 10.10.60.30 -l root -pw <password> -ssh /nas/sbin/nas_halt now
This works fine but after this command it prompts for a yes. Nas_halt command has no auto setting to input yes so it just sits there waiting for input.
Is there any way I could set this up? e.g getting plink to call a Linux script which calls nas_halt and inputs the yes after?? If so what would this be?
Any help would be superb.
Cheers
Baker0
- 11-25-2008 #2Linux User
- Join Date
- Jan 2007
- Location
- cleveland
- Posts
- 452
try the command "yes"
the sun is new every day (heraclitus)
- 11-26-2008 #3Just Joined!
- Join Date
- Nov 2008
- Posts
- 11
A Python script with Pexpect - Noah.org might work?
- 11-30-2008 #4Just Joined!
- Join Date
- Nov 2008
- Location
- Virginia, USA
- Posts
- 18
Yes
This should work:
If nas_halt is expecting "y" then piping the yes command will work. If nas_halt is expecting "yes' then do:Code:yes | plink 10.10.60.30 -l root -pw <password> -ssh /nas/sbin/nas_halt now
Code:yes yes | plink 10.10.60.30 -l root -pw <password> -ssh /nas/sbin/nas_halt now


Reply With Quote