Sponsored Content
Special Forums IP Networking Problem with script execution from a DHCP event Post 302587284 by bypper on Wednesday 4th of January 2012 11:47:45 AM
Old 01-04-2012
Problem with script execution from a DHCP event

Hi,

I'm installing a DHCPD Server with the packages from a distro SLES11 SP1 (dhcp-server-3.1.1-7.12).

And a DNS Server with PowerDNS:

pdns-recursor-3.3-1
pdns-static-3.0-1


The DHCP update de DNS Server, but PowerDNS is not RFC 2135 compliant, and I have to update the MySQL register from PowerDNS with a script, when the leased is changed.

This event is reached with the DHCP event managed in...

/etc/dhcpd.conf:
...
include "/etc/dhcpd/dhcpd.subnet";
...
/etc/dhcpd/dhcpd.subnet:
...
subnet 192.168.12.0 netmask 255.255.255.0 {
option routers 192.168.12.2;
pool {
authoritative;
failover peer "dhcp_failover";
range 192.168.12.20 192.168.12.254;
}
include "/etc/dhcpd/dhcpd.events";
}
...
/etc/dhcpd/dhcpd.events:
...
on commit {
set ClientIP = binary-to-ascii(10, 8, ".", leased-address);
set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
log(concat("Commit: IP: ", ClientIP, " Mac: ", ClientMac, " Hostname: ", option host-name));
execute("/usr/local/bin/dhcp-event", "commit", ClientIP, ClientMac, option host-name);
}
...
The problem is that the script cannot run, the log error says "Unable to execute ...: No such file or directory" "... exit status 32512".
I cannot understand why:
...
Jan 4 17:19:09 342falsa dhcpd: Commit: IP: 192.168.12.44 Mac: 0:c:29:81:5:2b Hostname: mandingo
Jan 4 17:19:09 342falsa dhcpd: execute_statement argv[0] = /usr/local/bin/dhcp-event
Jan 4 17:19:09 342falsa dhcpd: execute_statement argv[1] = commit
Jan 4 17:19:09 342falsa dhcpd: execute_statement argv[2] = 192.168.12.44
Jan 4 17:19:09 342falsa dhcpd: execute_statement argv[3] = 0:c:29:81:5:2b
Jan 4 17:19:09 342falsa dhcpd: execute_statement argv[4] = mandingo
Jan 4 17:19:09 342falsa dhcpd: Unable to execute /usr/local/bin/dhcp-event: No such file or directory
Jan 4 17:19:09 342falsa dhcpd: execute: /usr/local/bin/dhcp-event exit status 32512
Jan 4 17:19:09 342falsa dhcpd: DHCPREQUEST for 192.168.12.44 from 00:0c:29:81:05:2b (mandingo) via eth0
Jan 4 17:19:09 342falsa dhcpd: DHCPACK on 192.168.12.44 to 00:0c:29:81:05:2b (mandingo) via eth0
...
The contents from "/usr/local/bin/dhcp-event" is irrelevant, I probed with another code, with another command interpreter, with anothers paths ...
The error is always the same:
...
dhcpd: Unable to execute PATH/SCRIPT: No such file or directory
dhcpd: execute: PATH/SCRIPT exit status 32512
...
I probed with total permissions, with a owner "dhcpd" (the execution from dhcp is "chrooted") ... but the same.

Can somebody help me?
Thank you very much

Best Regards,

Sorry, my English is not good. Be patient ;-)

Last edited by bypper; 01-04-2012 at 01:03 PM..
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

problem with shell script execution

Hi All, i am running a shell script in which there is a command `ps -ef | grep smon > db` When i execute this command in the command prompt i am getting the desired output..but when the script is executed..the db file is getting created but with no values...I could not find the reason for... (2 Replies)
Discussion started by: anju
2 Replies

2. Shell Programming and Scripting

problem with remote execution of script using telnet

Hi all, i am trying to remotely execute a script from a different server. this is the code that i use : #!bin/sh pwd (sleep 1 echo "username" sleep 2 echo "pwd" sleep 2 echo "cd /path/to/file" if then echo "script1.sh" echo "mailx -s "Task Executed"... (1 Reply)
Discussion started by: sais
1 Replies

3. UNIX for Advanced & Expert Users

How to get DHCP address change event notification programmatically?

Hello Experts, I am working on a software that has network client-server architecture. I need to have a mechanism that notifies me upon change of dhcp address change locally or at remote machine. Windows have IP Helper APIs to get address change notification. Is there something similar in Unix?... (3 Replies)
Discussion started by: GajendraSharma
3 Replies

4. Shell Programming and Scripting

parallel execution of script/ synchro problem

Hi everybody, In a csh script, i need to run 4 time the same prog with different parameters. What i want is to run them in parallel. for this i use the command toto1.sh & toto2.sh & toto3.sh & toto4.sh For this I have no problem. In fact, I need to wait until all the programs are over to... (2 Replies)
Discussion started by: Moumou
2 Replies

5. Shell Programming and Scripting

Execution problem with grep script (2 variables)

#!\bin\sh TEST=test.log GREP=\usr\bin\grep $GREP -i 'dog\|cat' ${TEST} Why doesn't grep run at all? (10 Replies)
Discussion started by: jazzaddict
10 Replies

6. Shell Programming and Scripting

Execution problem with shell script

Hi all, I want to use perl string manipulation commands in my shell script. I have written following script. echo "enter name" read name perl -e '$m=length($name); echo $m it gives an error: unrecognized token in perl command line. do not suggest me an equivalent command of shell... (3 Replies)
Discussion started by: admc123
3 Replies

7. Shell Programming and Scripting

Execution problem with csh script

Hi All, I have a small issue with my csh script which I am using to FTP a file. What I know is...there are two commands to execute script.. 'sh <file>' & '\<file>'. When I execute my script with command 'sh <file>', it gives me syntax error while it runs successfully with command '\<file>'. I am... (3 Replies)
Discussion started by: ndd
3 Replies

8. Solaris

Execution problem in shell script while insert into DB

Hi, am facing some problem while inserting a record into a script Please find script below. `sqlplus -s asdf/asdf123 <<eof! set feedback off; set heading off; set verify off; insert into... (2 Replies)
Discussion started by: senkerth
2 Replies

9. Shell Programming and Scripting

Execution problem with shell script for modifying a user

#/bin/sh echo "enter the user name" read $username echo "Enter new home directory" read $newhd usermod -d $newhd $username ;; error while executing : enter the user name Rev Enter new home directory: /home/58745 usermod: option requires an argument -- 'd' Try `usermod --help' or... (2 Replies)
Discussion started by: Revanth547
2 Replies
DHCPING(8)						      General Commands Manual							DHCPING(8)

NAME
dhcping - send a DHCP request to DHCP server to see if it's up and running SYNOPSIS
dhcping [-v] [-q] [-i] [-r] -t maxwait -c client-IP-address -s server-IP-address -h client-hardware-address [-g gateway-IP-address] DESCRIPTION
This command allows the system administrator to check if a remote DHCP server is still functioning. Options are: -v Verbose, print some information. -i Use DHCPINFORM packets. -r Use DHCPREQUEST packets (default behaviour). -q Quiet, print nothing on the screen. -t maxwait Maximum time to wait for an answer from the server in seconds. Default is 3 seconds. -c client-IP-address Request this IP address. Note that this is also the IP address the answer will be sent to. -s server-IP-address Send the DHCP packet to this IP address. -h client-hardware-address Use this hardware-address in the DHCP request. It can be up to sixteen octets seperated by colons (i.e. 01:02:03:04) -g gateway-IP-address Use this IP address for the gateway IP address in the DHCP packet. This option is currently broken. RETURN VALUES
If everything goes okay, it returns 0. If there went something wrong, it returns 1. SETUP
This program should be installed setuid root or ran by root only. See SECURITY for more information. On your DHCP server, add these lines to the dhcpd.conf: host <your monitoring host FQDN> { hardware ethernet <your monitor host mac address>; fixed-address <your monitoring host IP address>; } Then try it: $ dhcping -c your monitoring host IP address -s your DHCP server IP address -h your monitor host mac address It will either respond with "no answer" or "Got answer from: your DHCP server IP address" The DHCP server logfile will give: DHCPREQUEST for 192.168.1.1 from 00:20:18:56:29:8f via ed0 DHCPACK on 192.168.1.1 to 00:20:18:56:29:8f via ed0 DHCPRELEASE of 192.168.1.1 from 00:20:18:56:29:8f via ed0 (found) Running in DHCPINFORM mode with -i: If you see "DHCPINFORM from 192.168.1.1 via xl0: not authoritative for subnet 192.168.1.0", you should add the authoritative statement to the subnet, See dhcpd.conf(5) for details. When running in very verbose mode, dhcping tries to dump all data of the send and received DHCP packets. It will first dump the packet in hex-format, then decodes the header and finally the options. HOW IT WORKS
The client either sends a DHCPREQUEST or DHCPINFORM packet to the server and waits for an answer. Then, if a DHCPREQUEST was send, it will send a DHCPRELEASE back to the server. SECURITY
This program is installed setuid root as it requires the privileges to bind itself to port 68 (bootpc). Root privileges are dropped as soon as the program has bound itself to that port. BUGS
Currently (this may, or may not, change in the future) the ISC DHCP daemon does not write leases with a fixed IP address in the dhcpd.leases file. DHCPINFORM packets can only be used on subnets the server is authori- tative for. If the monitoring script runs on a subnet the server isn't authoritative for, it should use the DHCPREQUEST packets. I also experienced some problems with ISC DHCPD v2 servers, but that is also in the README of it. The -V option is still working, but shouldn't be used for debugging of the packets. Better use dhcpdump(8) for that, which is available on my website. I wanted to remove it, but decided only to do it from the documentation, not from the code. Maybe I'll need it one day for debugging. AUTHOR
Edwin Groothuis, edwin@mavetju.org (http://www.mavetju.org) SEE ALSO
dhcpd(8), dhclient(8), dhcpd.conf(5), dhcpdump(8) Januari 27, 2002 Januari 27, 2002 DHCPING(8)
All times are GMT -4. The time now is 01:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy