LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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, 12: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, 01:01 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
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, 01: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, 01:07 PM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
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, 01:31 PM   #5
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

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

Rep: Reputation: 128Reputation: 128
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, 06: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, 07:12 PM   #8
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
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, 07:14 PM   #9
Riddick
Member
 
Registered: May 2004
Location: Rome, Italy
Distribution: slackware-current
Posts: 454

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


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

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:46 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
Open Source Consulting | Domain Registration