LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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



Reply
 
Search this Thread
Old 09-08-2005, 01:49 PM   #1
Riddick
Member
 
Registered: May 2004
Location: Rome, Italy
Distribution: slackware-current
Posts: 454

Rep: Reputation: 30
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
 
Old 09-08-2005, 02:01 PM   #2
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 118Reputation: 118
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.
 
Old 09-08-2005, 02:02 PM   #3
Riddick
Member
 
Registered: May 2004
Location: Rome, Italy
Distribution: slackware-current
Posts: 454

Original Poster
Rep: Reputation: 30
hello again! thanks a lot! I'll try that!
 
Old 09-08-2005, 02:07 PM   #4
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 118Reputation: 118
No problem. Obviously, then, you'll need to do 'ifup eth0' and 'ifdown eth0', but hey, that's even shorter than the ifconfig commands.
 
Old 09-08-2005, 02:31 PM   #5
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
How about using the dhclient command?
dhclient -r eth0 ( to release it )
dhclient eth0 ( to grab an ip address )
 
Old 09-08-2005, 02:42 PM   #6
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 118Reputation: 118
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.
 
Old 09-10-2005, 07:00 PM   #7
Riddick
Member
 
Registered: May 2004
Location: Rome, Italy
Distribution: slackware-current
Posts: 454

Original Poster
Rep: Reputation: 30
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
 
Old 09-10-2005, 08:12 PM   #8
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 118Reputation: 118
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.
 
Old 09-10-2005, 08:14 PM   #9
Riddick
Member
 
Registered: May 2004
Location: Rome, Italy
Distribution: slackware-current
Posts: 454

Original Poster
Rep: Reputation: 30
yeah exactly...
 
  


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
bash script: using "select" to show multi-word options? (like "option 1"/"o zidane_tribal Programming 6 03-21-2013 11:35 AM
what is "sticky bit mode" , "SUID" , "SGID" augustus123 Linux - General 10 08-03-2012 05:40 AM
Telling people to use "Google," to "RTFM," or "Use the search feature" Ausar General 77 03-21-2010 12:26 PM
"Xlib: extension "XFree86-DRI" missing on display ":0.0"." zaps Linux - Games 9 05-14-2007 04:07 PM
Can't install "glibmm" library. "configure" script can't find "sigc++-2.0&q kornerr Linux - General 4 05-10-2005 03:32 PM


All times are GMT -5. The time now is 02:12 PM.

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