View previous topic :: View next topic |
Author |
Message |
cthulu n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/gallery/The Fifth Element/movie_the_fifth_element_zog.gif)
Joined: 11 Oct 2002 Posts: 30
|
Posted: Wed Aug 13, 2003 4:28 pm Post subject: adsl connection via init.d script |
|
|
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
#!/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 |
|
![](templates/gentoo/images/spacer.gif) |
m0ns00n n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 25 Apr 2003 Posts: 13
|
Posted: Sat Aug 16, 2003 3:37 pm Post subject: Great! |
|
|
Great! Just a spelling mistake in one of the --background options.... but other than that, it works 100%! Thanks ![Smile :)](images/smiles/icon_smile.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
To Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/106869468452b5c7dd8e5d.png)
Joined: 12 Apr 2003 Posts: 1145 Location: Coimbra, Portugal
|
Posted: Sat Aug 16, 2003 4:04 pm Post subject: |
|
|
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
Tó[/quote] _________________
------------------------------------------------
Linux Gandalf 3.2.35-grsec
Gentoo Base System version 2.2
------------------------------------------------ |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
cthulu n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/gallery/The Fifth Element/movie_the_fifth_element_zog.gif)
Joined: 11 Oct 2002 Posts: 30
|
Posted: Wed Aug 20, 2003 3:12 pm Post subject: cool . . . |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
asimon l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/10090114603f36c07c6fe14.gif)
Joined: 27 Jun 2002 Posts: 979 Location: Germany, Old Europe
|
Posted: Thu Aug 21, 2003 10:20 am Post subject: Re: cool . . . |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
|