LinuxQuestions.org
Help answer threads with 0 replies.
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 10-18-2009, 09:34 AM   #1
nl1at
LQ Newbie
 
Registered: Mar 2004
Location: Uitgeest Netherlands
Posts: 26

Rep: Reputation: 15
DDclient slack13 dhcpcd.sh vs dhcpcd.eth0.exe question


In slack13 there is a dhcpcd.sh script like this:
Code:
#!/bin/sh
#
#  This is a sample /etc/dhcpc/dhcpcd.sh script.
#  /etc/dhcpc/dhcpcd.sh script is executed by dhcpcd daemon
#  any time it configures or shuts down interface.
#  The following parameters are passed to the dhcpcd.sh script:
#  $1 = HostInfoFilePath, e.g  "/etc/dhcpc/dhcpcd-eth0.info"
#  $2 = "up" if interface has been configured with the same
#       IP address as before reboot;
#  $2 = "down" if interface has been shut down;
#  $2 = "new" if interface has been configured with new IP address;
#
#  Sanity checks

if [ $# -lt 2 ]; then
	logger -s -p local0.err -t dhcpcd.sh "wrong usage"
	exit 1
fi

hostinfo="$1"
state="$2"

# Reading HostInfo file for configuration parameters
[ -e "${hostinfo}" ] && . "${hostinfo}"

case "${state}" in
	up)
	logger -s -p local0.info -t dhcpcd.sh \
	"interface ${INTERFACE} has been configured with old IP=${IPADDR}"
	# Put your code here for when the interface has been brought up with an
	# old IP address here
	;;

	new)
	logger -s -p local0.info -t dhcpcd.sh \
	"interface ${INTERFACE} has been configured with new IP=${IPADDR}"
	# Put your code here for when the interface has been brought up with a
	# new IP address
	;;

	down) logger -s -p local0.info -t dhcpcd.sh \
	"interface ${INTERFACE} has been brought down"
	# Put your code here for the when the interface has been shut down
	;;
esac
exit 0
Now my older slack distro has a file called dhcpcd-eth0.exe and ddclient has got a replacement for it so it updates my dyndns account like this :
Code:
#!/bin/sh
######################################################################
## $Header: /home/paul/src/ddclient/RCS/sample-etc_dhcpc_dhcpcd-eth0.exe,v 3.6 2002/11/03 20:20:16 root Exp $
######################################################################
PATH=/usr/sbin:${PATH}

## update the DNS server unless the IP address is a private address
## that may be used as a internal LAN address. This may be true if
## other interfaces are assigned private addresses from internal
## DHCP server.

case "$1" in
10.*)   	;;
172.1[6-9].* | 172.2[0-9].* | 172.3[0-1].*)	;;
192.168.*)	;;
*)
	logger -t dhcpcd IP address changed to $1
	ddclient -daemon=0 -syslog -use=ip -ip=$1 >/dev/null 2>&1
	;;
esac
My question is what code to insert to the dhcpcd.sh file to update dyndns with ddclient?
 
Old 10-18-2009, 03:21 PM   #2
MQMan
Member
 
Registered: Jan 2004
Location: Los Angeles
Distribution: Slack64 14.1
Posts: 581

Rep: Reputation: 38
dhcpcd.sh is a straight replacement for dhcpcd.exe, not dhcpcd-eth0.exe.

Its' dhcpcd.exe that is invoked by dhcpcd, so the first thing to do, is to find out how your dhcpcd-eth0.exe is called. Then you can look at modifying dhcpcd.sh.

My, easier, guess, would be to find the line in dhcpcd.exe, that outputs the IP to the log, which is followed by the comment "Put your code here", and follow it with:
Code:
case "${IPADDR}" in
10.*)   	;;
172.1[6-9].* | 172.2[0-9].* | 172.3[0-1].*)	;;
192.168.*)	;;
*)
	ddclient -daemon=0 -syslog -use=ip -ip=${IPADDR} >/dev/null 2>&1
	;;
esac
Cheers.

Last edited by MQMan; 10-18-2009 at 03:48 PM. Reason: Modified code, for dhcpcd.exe usage.
 
Old 10-22-2009, 01:03 PM   #3
nl1at
LQ Newbie
 
Registered: Mar 2004
Location: Uitgeest Netherlands
Posts: 26

Original Poster
Rep: Reputation: 15
Hey thanks!
Gonna try that.
 
Old 10-27-2010, 01:51 PM   #4
nl1at
LQ Newbie
 
Registered: Mar 2004
Location: Uitgeest Netherlands
Posts: 26

Original Poster
Rep: Reputation: 15
This does not seem to work?

And dhcpcd.sh always says that my interface was brought up with new ipnr.
But it always get the same adress?
With no cat cable attached and dhcpcd gives a ipnr in the 169 segment it says configured with old ip nr???
 
  


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
/etc/dhcpc/dhcpcd-eth0.exe mattp Linux - Networking 4 02-19-2022 06:21 AM
dhcpcd wireless problems. dhcpcd wlan0 removes essid entry in iwconfig. Romanus81 Slackware 3 08-25-2008 10:34 PM
eth1 does not dhcpcd automatically, eth0 does? Satriani Slackware 3 10-25-2007 04:02 PM
Disable dhcpcd for eth0 on boot thomasw92 Linux - Newbie 2 04-10-2006 01:49 AM
eth0 removed from ifconfig after dhcpcd eth0 johnklvr Linux - Networking 3 01-15-2004 08:21 PM

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

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