GIDForums  

Go Back   GIDForums > Computer Forums > Computer Software Forum - Linux
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 21-Nov-2008, 08:29
Baker0 Baker0 is offline
New Member
 
Join Date: Nov 2008
Posts: 3
Baker0 is on a distinguished road

Automatic shut down for our linux boxes via our UPS


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
  #2  
Old 21-Nov-2008, 08:59
admin's Avatar
admin admin is offline
Administrator
 
Join Date: Sep 2002
Posts: 858
admin will become famous soon enough

Re: Automatic shut down for our linux boxes via our UPS


I am certainly no guru but why can't you use the shutdown command in your script?

Code:
/sbin/shutdown -h +5
... something like that?
__________________
Custom BB codes you can use here:
[HTML] | [C++] | [CSS] | [JAVA] | [PY] | [VB]
  #3  
Old 21-Nov-2008, 09:10
Baker0 Baker0 is offline
New Member
 
Join Date: Nov 2008
Posts: 3
Baker0 is on a distinguished road

Re: Automatic shut down for our linux boxes via our UPS


Hello, thanks for the quick reply. Does the shutdown command shut down the nas part of the server cleanly?
  #4  
Old 21-Nov-2008, 09:14
admin's Avatar
admin admin is offline
Administrator
 
Join Date: Sep 2002
Posts: 858
admin will become famous soon enough

Re: Automatic shut down for our linux boxes via our UPS


Typing man shutdown explains it all. I'll copy (and paste) the description below as well:

Quote:
DESCRIPTION
shutdown brings the system down in a secure way. All logged-in users are notified that the system is going down,
and login(1) is blocked. It is possible to shut the system down immediately or after a specified delay. All pro-
cesses are first notified that the system is going down by the signal SIGTERM. This gives programs like vi(1) the
time to save the file being edited, mail and news processing programs a chance to exit cleanly, etc. shutdown does
its job by signalling the init process, asking it to change the runlevel. Runlevel 0 is used to halt the system,
runlevel 6 is used to reboot the system, and runlevel 1 is used to put to system into a state where administrative
tasks can be performed; this is the default if neither the -h or -r flag is given to shutdown. To see which
actions are taken on halt or reboot see the appropriate entries for these runlevels in the file /etc/inittab.
__________________
Custom BB codes you can use here:
[HTML] | [C++] | [CSS] | [JAVA] | [PY] | [VB]
  #5  
Old 24-Nov-2008, 06:17
Baker0 Baker0 is offline
New Member
 
Join Date: Nov 2008
Posts: 3
Baker0 is on a distinguished road

Re: Automatic shut down for our linux boxes via our UPS


Ive just been infomed that we cant use a shutdown command because its not shutting down the nas. So i do need a script for nas_halt with some sort of yes auto input after the command... any ideas?

Cheers
  #6  
Old 24-Nov-2008, 08:11
admin's Avatar
admin admin is offline
Administrator
 
Join Date: Sep 2002
Posts: 858
admin will become famous soon enough

Re: Automatic shut down for our linux boxes via our UPS


I am sorry Baker0, before today I only knew that NAS are commonly running on Linux and I assumed it was as simple as that. Reading up a bit more on the subject now I realise that this is not the case.
__________________
Custom BB codes you can use here:
[HTML] | [C++] | [CSS] | [JAVA] | [PY] | [VB]
  #7  
Old 26-Nov-2008, 10:54
admin's Avatar
admin admin is offline
Administrator
 
Join Date: Sep 2002
Posts: 858
admin will become famous soon enough

Re: Automatic shut down for our linux boxes via our UPS


Quote:
Originally Posted by Baker0
... So i do need a script for nas_halt with some sort of yes auto input after the command... any ideas?

Since no one is offering a script to do this, would you be interested in one written in PHP (for the command line)? Can your server run PHP scripts? In other words, is PHP installed on your server?
__________________
Custom BB codes you can use here:
[HTML] | [C++] | [CSS] | [JAVA] | [PY] | [VB]
 
 

Recent GIDBlogProblems with the Navy (Enlisted) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How To Remove Linux And Install Windows? rockaway Computer Software Forum - Windows 3 06-Mar-2008 21:00
Web stats fcolor Web Design Forum 10 12-Jul-2007 08:48
Need Free Website Templates sam_dezine Web Design Forum 8 06-Sep-2006 03:25
Pixel script Template customization gatufats Web Design Forum 2 29-Jun-2006 04:05
HTML Code amgujral Web Design Forum 0 07-Apr-2006 09:46

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 00:35.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.