LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 10-03-2004, 05:55 AM   #1
Tihi
LQ Newbie
 
Registered: Aug 2004
Distribution: Slackware
Posts: 19

Rep: Reputation: 0
auto dialup


Hi to all!
I have a following question:
I need a litle script that checks if there is an internet connection and if not to start "startadsl" on a regular intervals. Something that checks ip ppp0 is up or do a ping and saves rezult in a variable. I have no correct ideas
10x in advance
 
Old 10-03-2004, 06:29 AM   #2
redgore
Member
 
Registered: Dec 2001
Location: England
Distribution: Various,currently Slackware.
Posts: 156

Rep: Reputation: 30
youd need to check the output of ifconfig, the exit value will help to see if it found anything. for the polling best bet would be to crontab it.
 
Old 10-03-2004, 06:39 AM   #3
Tihi
LQ Newbie
 
Registered: Aug 2004
Distribution: Slackware
Posts: 19

Original Poster
Rep: Reputation: 0
How to check the exit value? Which is the exit value?
 
Old 10-03-2004, 07:59 AM   #4
redgore
Member
 
Registered: Dec 2001
Location: England
Distribution: Various,currently Slackware.
Posts: 156

Rep: Reputation: 30
my last post wasnt worded right anyway so here it is better with more information.

To find out if ppp0 is up you need to grep the output of ifconfig for it, using 'ifconfig | grep ppp0' if anything is found the exit value is 0 if nothing is found it is 1. to check the exit value use the variable $? which is a bash bult-in variable. So the script would be something like this:
Code:
#!/bin/bash
ifconfig | grep ppp0 > /dev/null
if [ $? = "1" ]
then startadsl
fi
 
Old 10-03-2004, 08:51 AM   #5
Tihi
LQ Newbie
 
Registered: Aug 2004
Distribution: Slackware
Posts: 19

Original Poster
Rep: Reputation: 0
Thank you very much!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I auto start modules that aren't auto loaded on boot? darkbluedrew Debian 2 09-18-2005 10:10 AM
eth0 Auto Connect, How to auto start on logon cornish Linux - Networking 2 05-09-2005 01:02 PM
linux dialup faster and more stable than windows dialup -why? whitshade Linux - Networking 4 06-19-2004 04:52 PM
auto-completion - how does it work & can my script args auto-complete? BrianK Programming 1 06-11-2004 05:51 PM
autofs enabled in kernel but auto.mount and auto.master are NOT in /etc! Alybyzrp Linux - General 0 11-11-2003 01:26 PM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration