LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-02-2004, 07:57 PM   #1
arkamir
Member
 
Registered: Nov 2003
Location: Califroni
Distribution: Fedora
Posts: 51

Rep: Reputation: 15
Bash Scipting ping question


I need to right a script(bash preferably) which when ping returns Destination Host Unreachable it restarts my access point. My question is how do I know when ping returns Destination Host Unreachable? I know I can call the command but i dont know how to get the results. To restart the access point I need to open a browser, input my name and password into the popup window, click okay then in the browser, click advanced then apply then continue. How would I do this?


Thanks a lot!!!!
Conrad
 
Old 02-02-2004, 09:02 PM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
I haven't done anything with access points so I can't be of much help there. This diddy will return an answer if the ping was successful or not. Maybe that will get you started.....
Code:
#!/bin/bash
clear
echo
echo ""
echo "Please type the address to ping: "
read NUMBER
echo
ping -c 3 ${NUMBER} | grep --max-count=1 'packets' | \
cut -d, -f2 | cut -dr -f1 > /home/address.txt
#
address="/home/address.txt"
cat ${address} | \
while read NUM
do
if [ $NUM -ne '3' ]; then
echo -e '\a'
echo "${NUMBER} unreachable"
echo
echo
else
echo "${NUMBER} is ok"
echo
fi
 
done
 
Old 02-03-2004, 07:18 PM   #3
arkamir
Member
 
Registered: Nov 2003
Location: Califroni
Distribution: Fedora
Posts: 51

Original Poster
Rep: Reputation: 15
thanks thats a good start
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange Ping Issue - Can't ping localhost but can ping others on LAN code_slinger Linux - Networking 15 03-30-2015 02:39 PM
shell scipting: append output of a command to a variable jonhewer Linux - Newbie 10 08-24-2005 05:42 AM
Ping question a5an0 Linux - Networking 5 05-09-2005 09:54 PM
Ping question mikeshn Linux - Networking 2 06-01-2003 07:42 PM
Question about ping. jayakrishnan Linux - General 2 04-10-2002 01:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration