Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
09-08-2005, 12:49 PM
|
#1
|
Member
Registered: May 2004
Location: Rome, Italy
Distribution: slackware-current
Posts: 454
Rep:
|
tying "dhcpcd" into "ifconfig" up and down
Hi, sorry about the confusing thread title,
I would like "dhcpcd" to be called when I do "ifconfig eth0 up"
and I would like it to be killed when I call "ifconfig eth0 down"
I have slackware current, kde 3.4.2...
Thanks for any help,
Riddick
|
|
|
09-08-2005, 01:01 PM
|
#2
|
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507
Rep: 
|
Why not create an ifup/ifdown script like debian has?
Code:
#!/bin/bash
#ifup
ifconfig $1 up
dhcpcd $1
Code:
#!/bin/bash
#ifdown
kill `cat var/run/dhcpcd-$1.pid`
ifconfig $1 down
Error checking for $1 and so forth could also be added, but I'm sure you get the idea.
|
|
|
09-08-2005, 01:02 PM
|
#3
|
Member
Registered: May 2004
Location: Rome, Italy
Distribution: slackware-current
Posts: 454
Original Poster
Rep:
|
hello again! thanks a lot! I'll try that!
|
|
|
09-08-2005, 01:07 PM
|
#4
|
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507
Rep: 
|
No problem. Obviously, then, you'll need to do 'ifup eth0' and 'ifdown eth0', but hey, that's even shorter than the ifconfig commands. 
|
|
|
09-08-2005, 01:31 PM
|
#5
|
Senior Member
Registered: Oct 2003
Posts: 3,057
Rep:
|
How about using the dhclient command?
dhclient -r eth0 ( to release it )
dhclient eth0 ( to grab an ip address )
|
|
|
09-08-2005, 01:42 PM
|
#6
|
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507
Rep: 
|
The OP was trying to get this to work with dhcpcd, not dhclient. Though dhcpcd supports -k which shuts down the daemon after sending a release.
|
|
|
09-10-2005, 06:00 PM
|
#7
|
Member
Registered: May 2004
Location: Rome, Italy
Distribution: slackware-current
Posts: 454
Original Poster
Rep:
|
excellent... my shelling skills are being tested for the input
validation .. I might tie down the scripts to just be eth0
and forget it all!
thanks for everything!
Riddick
|
|
|
09-10-2005, 07:12 PM
|
#8
|
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507
Rep: 
|
You know, if it is a script only to be used by you, I wouldn't worry too much about input validation. I know, famous last words, but it seems to work for me. 
|
|
|
09-10-2005, 07:14 PM
|
#9
|
Member
Registered: May 2004
Location: Rome, Italy
Distribution: slackware-current
Posts: 454
Original Poster
Rep:
|
yeah exactly...
|
|
|
All times are GMT -5. The time now is 09:10 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|