How do I set up a shell script using ifconfig?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How do I set up a shell script using ifconfig?
# 1  
Old 02-18-2009
How do I set up a shell script using ifconfig?

I am running on AIX 5.3. I have a remote AIX server running on a generator. Many times the generator goes out and I only have a window of 15 mins with the network up and 30 mins the server is powered. I need help creating a script using ifconfig, where it goes out and checks the network every 5 mins and to see if the network is up. If the network is up thats fine. If the script detects the network is down, then I want the script to check the network in 5 mins to make sure the network has come back up or not and then repeat the same step; check it again in 5 mins, totaling 15 mins of checking. If the network has been down for 15 mins, then I want the script to shutdown the server before the generator runs out of power. I need this server to always perform a clean shutdown and not to abrubtly shutoff because the power goes out.
# 2  
Old 02-18-2009
I don't think you want to use ifconfig for this type of monitoring. Using the ping utility is a better option or check the interface status with entstat. this could accidently bring the server down though if your having network issues. you could also run into issues if the power cycles in the middle of your script. you may think the network is up when 2 minutes later it goes off again and as a result your server may not shutdown in time.

Can you enable some remote monitoring to trigger an alarm/page to force someone manually do a shutdown remotely via modem perhaps?
# 3  
Old 02-18-2009
Well I could try ping but I am horrible at shell scripting. Would you be able to write me a basic script of how to check if the network is up, to check it 3 times in 5 min intervals and if it is up continue, but if it is down then shutdown the server??

Also, we can't enable any remote work on it. The server is in a trailer in a remote area working off a generator. We have someone go out once a month to check on it. We have been having a lot of crashing shutdowns. My goal is to get a script running to get clean shutdowns.

THANK YOU
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Help with ifconfig shell script

I am new to shell scripting and trying to create a shell script which will extract and print only ip address from ifconfig command and not all the information. I have two issues here - 1. To know active interface like eth0, wl0, etc. - I guess `route` command will give me interface name in last... (3 Replies)
Discussion started by: amarshukla
3 Replies

2. Shell Programming and Scripting

Help needed with shell script to search and replace a set of strings among the set of files

Hi, I am looking for a shell script which serves the below purpose. Please find below the algorithm for the same and any help on this would be highly appreciated. 1)set of strings need to be replaced among set of files(directory may contain different types of files) 2)It should search for... (10 Replies)
Discussion started by: Amulya
10 Replies

3. Shell Programming and Scripting

how to set/get shell env variable in python script

greetings, i have a sh script that calls a python script. the sh script sets an env variable BIN: export BIN=bin64i need to get that BIN variable's value and use it within this python script. anyone know how to do this? thanx in advance. (5 Replies)
Discussion started by: crimso
5 Replies

4. Shell Programming and Scripting

$1 stays set after sourcing shell script.

ok, so I have a shell script that can be called using the first argument ($1) or not. This argument is a word (Tim for example) and not an actual flag (-x for example). If I call the script with an argument and call the same script without one, it believes that I provided an argument. Note here... (2 Replies)
Discussion started by: mrwatkin
2 Replies

5. Shell Programming and Scripting

how to set password/encrypt a shell script

Hi, I have written a shell script in unix for my customer. Now I want to make it only execute and not to read/write. Can anybody help me how to set password protect/encript my script. Thanks Suresh (3 Replies)
Discussion started by: suresh3566
3 Replies

6. Shell Programming and Scripting

How to set PATH using shell script [resolved]

Hi, Can anyone help me on how to set PATH using shell scripting.. Please find the shell script code here.... #!/bin/bash PATH = $PATH:/opt/app/oracle/product/10.2.0/bin export PATH echo $PATH exit When i execute this script i get the following error ./backup.sh: line 2: PATH:... (0 Replies)
Discussion started by: srinivasj
0 Replies

7. Shell Programming and Scripting

Can I set Password to open my shell script?

Hi All, please help me on how to secure my shell script? I chnanged it to read-only mode using 'chmod'. but still i would like to set password for open the script. Is there any way? Please help me!! Thankyou all in advance!! :b: (6 Replies)
Discussion started by: little_wonder
6 Replies

8. Shell Programming and Scripting

set password using a shell script

Hi All How can I set password in linux.It is OK if it display password in plain text in script. manually i can set: #passwd Changing password for root Enter new password: Bad password: too weak. Re-enter new password: Password changed. # I want this to be done by script.Please let me... (2 Replies)
Discussion started by: tannu
2 Replies

9. Shell Programming and Scripting

building a SET clause in shell script

Hi, I have a comma delimited string, e.g. empno, ename, sal. Using Korn Shell Script I want to build the SET clause for an UPDATE statement, and set clause should look like this: empno=decode(:empno, '?', empno, :empno), ename=decode(:ename, '?', empno, :ename), sal=decode(:sal, '?',... (14 Replies)
Discussion started by: shalua
14 Replies
Login or Register to Ask a Question