Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
adsl connection via init.d script
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
cthulu
n00b
n00b


Joined: 11 Oct 2002
Posts: 30

PostPosted: Wed Aug 13, 2003 4:28 pm    Post subject: adsl connection via init.d script Reply with quote

Alright .. since there is no init.d script for the dsl connection .. and i wanted it to be started via an init.d script this is the one i came up with.
If there are issues or anything please let me know



First ..you need to make sure that you have configured your adsl account, and test the connection by running adsl-start

if it connects then add this script into your /etc/init.d/
I call the scrip adsl .. call it whatever you like :P

#!/sbin/runscript

depend() {
need net.eth0
}

start() {
ebegin "Starting adsl"
start-stop-daemon --start --quiet --exec /usr/sbin/adsl-start --background
eend $?
}

stop() {
ebegin "Stoping adsl"
start-stop-daemon --start --quiet --exec /usr/sbin/adsl-stop --backgorund
eend $?
}


That is it. If you are asking youself why i have "start" in the stop function .. i am simply using the existing adsl start and stop scripts to execute then connection .. and sinice the adsl-stop script needs to be run to stop the connection .. this works well. I am SURE that if someone wants to take the time and write a better script they can .. (heck if i wanted to take the time and do it i could), but i wanted something fast and that worked .. so there you go.
Back to top
View user's profile Send private message
m0ns00n
n00b
n00b


Joined: 25 Apr 2003
Posts: 13

PostPosted: Sat Aug 16, 2003 3:37 pm    Post subject: Great! Reply with quote

Great! Just a spelling mistake in one of the --background options.... but other than that, it works 100%! Thanks :)
Back to top
View user's profile Send private message
To
Veteran
Veteran


Joined: 12 Apr 2003
Posts: 1145
Location: Coimbra, Portugal

PostPosted: Sat Aug 16, 2003 4:04 pm    Post subject: Reply with quote

I also have this on my cron.hourly:
Code:
#! /bin/bash
EXTIP="ping -c 1 `route -n|grep "^0.0.0.0"|awk '{print $2}'` | grep '1 received'"
if [ "$EXTIP" = '' ]; then
        /etc/init.d/net.eth1 restart
else
        echo "DHCP connection active!"
fi


since my eth1 is my cable connection, and from times to times I lose signal, my machine stays with IP but it's needed to restart the network in order to get network again. This script check if it can ping the gateway on my net. If it does does nathing except that echo, else it's restarts the network of my external device. May be usefull :wink:

Tó[/quote]
_________________

------------------------------------------------
Linux Gandalf 3.2.35-grsec
Gentoo Base System version 2.2
------------------------------------------------
Back to top
View user's profile Send private message
cthulu
n00b
n00b


Joined: 11 Oct 2002
Posts: 30

PostPosted: Wed Aug 20, 2003 3:12 pm    Post subject: cool . . . Reply with quote

Nice cron. Only reason i wanted to go with the init.d script was that i am using a laptop and most of the time. I wonder if it would be possable to get this init.d script into the gentoo portage tree .. maybe as a patch to pppoe.
Back to top
View user's profile Send private message
asimon
l33t
l33t


Joined: 27 Jun 2002
Posts: 979
Location: Germany, Old Europe

PostPosted: Thu Aug 21, 2003 10:20 am    Post subject: Re: cool . . . Reply with quote

cthulu wrote:
I wonder if it would be possable to get this init.d script into the gentoo portage tree .. maybe as a patch to pppoe.


Just post an enhancement bug report to bugzilla.gentoo.org for pppoe.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum