LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-14-2004, 05:17 PM   #1
Lars79
Member
 
Registered: Jan 2004
Distribution: Slackware
Posts: 96

Rep: Reputation: 15
Run program when internet comes up


Hi,

I have a Router with Slackware 10 running. I just changed from Debian to Slackware and I don't know much about the Slackware init style by now. I have an DynDNS account and want to update my IP with DDClient. I copied the executable to /usr/sbin and the ddclient.conf to /etc. Works great. Now I don't want to do that manually, but have that done whenever a new internet conncection is established/IP changes. I also have a cronjob running which disconnects and reconnects twice a day, so a call to /sbin/ddclient in rc.local wouldn't do the job. Unfortunately I have no clue where to place the call instead.

Sorry for the stupid question. Must be really easy, but can't figure it out right now.

Thanks =).
 
Old 08-14-2004, 05:33 PM   #2
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 244Reputation: 244Reputation: 244
Iwould add the comand to start your client in /etc/rc.d/rc.inet2 at the end of the file.
 
Old 08-14-2004, 06:01 PM   #3
Mephisto
Member
 
Registered: Oct 2002
Location: Washington D.C, USA
Distribution: Slack 12, Etch, Gutsy
Posts: 453

Rep: Reputation: 31
Could you not just run the DDClient after the cronjob that disconnects and reconnects you? Alternatively you could pipe your address into a file and check periodically to see if your current address matches the one in the file, if it does not then update the file and call DDClient. But this would still effectively be a cron job.
 
Old 08-14-2004, 06:02 PM   #4
Mephisto
Member
 
Registered: Oct 2002
Location: Washington D.C, USA
Distribution: Slack 12, Etch, Gutsy
Posts: 453

Rep: Reputation: 31
You'll want to keep the one in rc.local though for initialization.
 
Old 08-14-2004, 06:09 PM   #5
Lars79
Member
 
Registered: Jan 2004
Distribution: Slackware
Posts: 96

Original Poster
Rep: Reputation: 15
@Cedrik:
Thanks for the fast reply. I placed a simple /usr/sbin/ddclient at the end of rc.inet2, but i doesn't work. It doesn't run it ?!?. I also couldn't find anything in the logs..

@Mephisto:
I also thought about to run it after the cronjob, but sometimes I have to manually close the internet connection for maintenance and so on.. In that cases I would still have to call ddclient by hand..
 
Old 08-14-2004, 06:20 PM   #6
Mephisto
Member
 
Registered: Oct 2002
Location: Washington D.C, USA
Distribution: Slack 12, Etch, Gutsy
Posts: 453

Rep: Reputation: 31
Quote:
Originally posted by Lars79
@Cedrik:
Thanks for the fast reply. I placed a simple /usr/sbin/ddclient at the end of rc.inet2, but i doesn't work. It doesn't run it ?!?. I also couldn't find anything in the logs..

@Mephisto:
I also thought about to run it after the cronjob, but sometimes I have to manually close the internet connection for maintenance and so on.. In that cases I would still have to call ddclient by hand..
what commands do you use to restart your connection? You could alias the command. Better yet why don't you create a bash script for when you manually close/start the connection that does whatever you need to do then calls ddclient.

If you can get the script working on load you should be set. I tend to suggest rc.local since it is the last thing called and is meant for your local specific scripts, but whatever works for you.
 
Old 08-14-2004, 06:32 PM   #7
Lars79
Member
 
Registered: Jan 2004
Distribution: Slackware
Posts: 96

Original Poster
Rep: Reputation: 15
Thanks for your help =).

what commands do you use to restart your connection?
I normally use the simple adsl-stop and adsl-start. Even the cronjob does a simple
adsl-stop; sleep 60; adsl-start

You could alias the command. Better yet why don't you create a bash script for when you manually close/start the connection that does whatever you need to do then calls ddclient.
Hm, that's a good idea. But the problem is that when the connection is terminated f.e. by accident (provider problem, whatever), it will connect again on demand. I don't know how to get an alias to work with that.

I tend to suggest rc.local since it is the last thing called and is meant for your local specific scripts, but whatever works for you.
I actually have an adsl-start in rc.local. If I could get it to work whenever a connection is established no matter how, ddclient would be run automatically.

I really appreciate your suggestions, but for the different possibilities to connect (connection at startup, manually connect and disconnect, connection on demand) I would really like a solution with an init script, because that is always run and I don't have to worry about the connection type.
 
Old 08-14-2004, 08:16 PM   #8
Mephisto
Member
 
Registered: Oct 2002
Location: Washington D.C, USA
Distribution: Slack 12, Etch, Gutsy
Posts: 453

Rep: Reputation: 31
I can't think of a solution then. Manually connecting and disconnecting is one thing, If the program automatically reconnects you I can't think of a way to know when that hapens. At best you could do a cron job as I mentioned above.
 
Old 08-15-2004, 01:57 AM   #9
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
What about an ip-up script in /etc/ppp?
 
Old 08-15-2004, 05:15 AM   #10
Lars79
Member
 
Registered: Jan 2004
Distribution: Slackware
Posts: 96

Original Poster
Rep: Reputation: 15
What about an ip-up script in /etc/ppp?
Thanks, sounds interesting. So far I don't have an ip-up or ip-up.local file in /etc/ppp. Would it be enough to just create the file and place the command in it, or ist there something else I had to do? Thanks =).

Edit: That works =). Thanks a lot. I just had to create the file, chmod it 755 and that's it.

Last edited by Lars79; 08-15-2004 at 05:40 AM.
 
Old 08-15-2004, 06:57 AM   #11
Mephisto
Member
 
Registered: Oct 2002
Location: Washington D.C, USA
Distribution: Slack 12, Etch, Gutsy
Posts: 453

Rep: Reputation: 31
Cool, learned something new today....
 
Old 08-15-2004, 03:13 PM   #12
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
My first project to learn a little BASH was to hack pppsetup so that it will set up dynamic DNS and simplify setup, so I had to study up on ppp. BTW if you are using dynamic DNS you might alos put a 'ping' line(5min) in ip-up so that it will maintain the connection.
 
Old 08-15-2004, 04:16 PM   #13
Lars79
Member
 
Registered: Jan 2004
Distribution: Slackware
Posts: 96

Original Poster
Rep: Reputation: 15
BTW if you are using dynamic DNS you might alos put a 'ping' line(5min) in ip-up so that it will maintain the connection.
Also a good idea, thanks. But I have MLDonkey running on the router and there's enough traffic to keep the connection alive =). But the ip-up and ip-down scripts are really helpfull. I also placed a call to the MLDonkey start script in ip-up and a call to the stop script in ip-down. Works great =)..
 
Old 08-15-2004, 04:55 PM   #14
Mephisto
Member
 
Registered: Oct 2002
Location: Washington D.C, USA
Distribution: Slack 12, Etch, Gutsy
Posts: 453

Rep: Reputation: 31
Lars79, one suggestion. when you are quoting somebody use [ QUOTE ] the message you are quoting [/ QUOTE ] taking out the spaces I added inside the brackets. This makes the message a little easier to read as to what you are quoting and what your response is.
 
Old 08-15-2004, 05:02 PM   #15
Lars79
Member
 
Registered: Jan 2004
Distribution: Slackware
Posts: 96

Original Poster
Rep: Reputation: 15
Quote:
Lars79, one suggestion. when you are quoting somebody use [ QUOTE ] the message you are quoting [/ QUOTE ] taking out the spaces I added inside the brackets. This makes the message a little easier to read as to what you are quoting and what your response is.
You're right =), sorry for that. I didn't notice the Quote button.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Viewing program messages when program isn't run from command line? Locura Linux - Software 1 09-27-2003 08:19 AM
please help me run this program joe blow Linux - Newbie 4 08-08-2003 10:07 AM
How do I run a program? rtstar Linux - Newbie 2 07-25-2003 09:08 AM
how to run program? newbe45 Linux - Newbie 31 07-24-2003 09:49 AM
want to run my C program........ gurpreetpall Programming 4 03-22-2002 03:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:26 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