Linux noob needing help with a script


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Linux noob needing help with a script
# 1  
Old 09-11-2010
Linux noob needing help with a script

Hi, Very new to linux but I've just recently setup an ubuntu server.

I have 2 broadband connections and would like to have fallback on the server should one of the lines fail.

I know what I want it to do, but dont know how to script it.

heres the senario;

ubuntu server with 2 ethernet adapters eth0 & eth1

both configured with the same static ip of 192.168.1.8

1 interface is enabled / 1 interface is disabled

the script needs to ;

1. disable eth1 and enable eth0
a. pause to wait for connection to establish
b. invoke dyndns script to upadte dns address
c. if failure_flag='yes' then email to blah@blah.com detailing ETH1 failure
d. Ping an internet address at a set interval every 5 mins - this should be configurable.
- is the ping successful ?
- Yes - set failure_flag='no' return to step 1d
- No - set failure_flag='yes' move to step 2

2. disable eth0 and enable eth1
a. pause to wait for connection to establish
b. invoke dyndns script to upadte dns addres
c. if failure_flag='yes' then email to blah@blah.com detailing ETH0 failure
d. Ping an internet address at a set interval every 5 mins
- is the ping successful ?
- Yes - set failure_flag='no' return to step 2d
- No - set failure_flag='yes' return to step 1

Simple in terms of writing it down, but don't have a clue as hoiw to code it.

If anyone is kind enough to help out I would be very gratefull.

Many thanks, ZC
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Noob. shell script with prompt?

Hey Guys and Gals, Im a complete Noob to Unix. But recently have started working on a unix system for my PET/CT scanner. My scanner comes with a MOD drive for backup. I would like to back up to USB (its alot cheaper). But the only way to do so is by manually enterin the unix commands. Id like to... (13 Replies)
Discussion started by: TorresGXL
13 Replies

2. Shell Programming and Scripting

Need help with simple script (noob)

Hi This is my first time attempting a bash script, or any kind of programming. I'm trying to get a clear picture but it helps to work backwards. It would be greatly appreciated if someone could show me what this script would look like... Write a script that displays todays date in... (1 Reply)
Discussion started by: earthicle
1 Replies

3. UNIX for Dummies Questions & Answers

Is there any way of splitting the script (Noob Here).

I m writing a script to check Server Hardening. The problem is whenever i add new point it grows and it become very tedious to edit the script file. Is there any way of making them separate and call them from one base script? Is it possible to define global variable that can be accessed via... (5 Replies)
Discussion started by: pinga123
5 Replies

4. Shell Programming and Scripting

Total noob script

Hi i am a total noob at shell scripting. i was wondering if somebody could help me with my script. i want the script to search the dev folder for the burner file because they are different between distrubutions? as i under stand it. this i the script. #!/bin/bash echo "Script för att bränna 360... (4 Replies)
Discussion started by: MatsO
4 Replies

5. Shell Programming and Scripting

Noob needs script help Grep

while read s1 s2; do grep -i -w $s1 6-29data | tr "" "" | sed 's/^*,//' | sed 's/200906/2009-06-/g' >> $s1.txt ; cat header > here ; cat $s1.txt | sort | uniq | tac >> here ; cat here | uniq > $s1.txt ; done < list Wow this almost worked file list has 8000 stock symbols which are... (4 Replies)
Discussion started by: harte
4 Replies

6. UNIX for Dummies Questions & Answers

New guy needing help writing a Unix Script

I'm very new with Unix and and am needing assistance in writing a Unix script that will uncompress a dated file then rename it. The script will also need to remove several old files that have a similar naming. The directory that the files reside in is call achdirdep the file that I need uncompress... (1 Reply)
Discussion started by: mlx707
1 Replies

7. Shell Programming and Scripting

Noob, script formatting query

Hi all, im new to the forums and i hope im not asking a heavily posted Q but here goes. I use the following script to do a simple calculation, the problem is, the data i receive is in the form of numbers with commas i.e. 1,000,000 This code below wont recognise the commas so i have to remove... (2 Replies)
Discussion started by: benjo
2 Replies

8. Shell Programming and Scripting

Why does my script not work? (Noob Alert)

I am a scripting noob and I have tried to search on google, but cannot find the answer as to why this script doesn't work properly. The idea of this script is that it will list all files starting with f in a certain folder, and delete all but the three newest one. I am trying to achieve this by... (4 Replies)
Discussion started by: bronkeydain
4 Replies

9. Shell Programming and Scripting

noob. need help to create a script.

Hi All. im a noob to scripting. could somone help me with a script please. what i want to do is. 1. run a cmd in the script - qmqtool -s this will give me an output similar to this. Messages in local queue: 790 Messages in remote queue: 306 Messages in todo queue: 23 i then want... (1 Reply)
Discussion started by: aron
1 Replies

10. UNIX for Dummies Questions & Answers

Using PHP script with crontab (NOOB)

Hi, I am trying to use a PHP script as a test for a cron job. My crontab is 1 line: 30 * * * * /home/www/inc/crontab.php if I test the file through the browser (ie. http://www.domain.com/inc/crontab.php), the PHP script works -- so there is nothing wrong with the PHP script itself or the... (5 Replies)
Discussion started by: Bobafart
5 Replies
Login or Register to Ask a Question