Sponsored Content
Top Forums Shell Programming and Scripting Shell/Perl Script to edit dhcpd.conf Post 302097130 by Yogesh Sawant on Wednesday 22nd of November 2006 01:20:15 AM
Old 11-22-2006
1. to read the file in an array:
Code:
my $dhcp_filename = "/path/to/dhcp.conf";
open (DHCP_FILE, "< $dhcp_filename")  or  die "Can not read file $dhcp_filename : $!";
my @dhcp_file = <DHCP_FILE>;
close (DHCP_FILE);

2. use the functions pop, push, shift, splice, and unshift to do operations on the array

3. to write contents of array back to the file:
Code:
open (DHCP_FILE, "> $dhcp_filename")  or  die "Can not write to file $dhcp_filename : $!";
print DHCP_FILE @dhcp_file;
close (DHCP_FILE);

 

10 More Discussions You Might Find Interesting

1. Linux

dhcpd.conf

I have intall a REdhat 9.0 as a server and Ive configure to act as a DHCP however Im having technical problems b/c the file /etc/dhcpd.conf does not exists. I went to the text edit and I created : subnet 192.192.168.100.0 netmask 255.255.255.0 { range 192.168.100.10 192.168.100.150;... (1 Reply)
Discussion started by: keliy1
1 Replies

2. UNIX for Dummies Questions & Answers

Cannot edit inetd.conf???

I'm trying to edit the inetd.conf but for some reason when I vi into it, it says "Read Only" even though I am root and the perms are 777?!? (2 Replies)
Discussion started by: shorty
2 Replies

3. Linux

dhcpd.conf - static route

Hi, I've setup DHCP Server on RH linux AS3 and everything works fine except static routes. They are not getting effected on client systems. My dhcpd.conf: +++++++++++ ddns-update-style interim; ddns-updates off; option domain-name-servers 192.168.116.122; option domain-name... (3 Replies)
Discussion started by: prvnrk
3 Replies

4. Shell Programming and Scripting

help on a perl script to edit file

Hi, sample file looks like this.. <hp> <name> <detail>adsg</detail> ... ... </name><ft>4264</ft> </hp> I need to edit the last but one line using perl script. I want the format to be .. <hp> <name> <detail>adsg</detail> ... ... </name> (9 Replies)
Discussion started by: meghana
9 Replies

5. Shell Programming and Scripting

shell script to edit a file

i have a file called number which contains data as 1 2 3 4 5 6 7 8 9 0 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 needed a shell script to print the output as 1 7 7 1 4 and (2 Replies)
Discussion started by: jacky29
2 Replies

6. UNIX for Dummies Questions & Answers

edit /etc/syslog.conf (Solaris 10)

Hi, Im editing the file /etc/syslog.conf for Solaris 10 server in production. I need to add "auth and authpriv.": someone set the same? Have been successful? I would appreciate any suggestions. Greetings. The unmodified arhive is: (0 Replies)
Discussion started by: musul
0 Replies

7. Shell Programming and Scripting

Help with Perl to change dhcpd.conf file

Hi all, I am too new for this stuff and i am lost in perl tutorials. I need help to change dhcp entries in .conf file with a perl script. The file entries are like below : host bertha-clp-0 { hardware ethernet AA:0A:A0:00:6c:40; fixed-address 10.10.10.72; option... (6 Replies)
Discussion started by: ekckabatop
6 Replies

8. Shell Programming and Scripting

Shell Script to check dhcp conf file

Hi, I have to prepare a script to check the dhcp conf file. The script has to check for a specific parameter called circuit ID. If the Circuit ID is unique it should show the output that it is unique and if it is duplicate it should show that the Circuit ID is duplicate. I have prepared the... (4 Replies)
Discussion started by: Crazy_Nix
4 Replies

9. Shell Programming and Scripting

Listing IPs from the dhcpd.conf

Hy everybody, Within a dhcpd.conf file, we got some fixed IP adresses from 192.168.0.1 - 192.168.0.254. Sample: #ddns-update-style interim; ddns-update-style none; ignore client-updates; deny client-updates; authoritative; #### By red for PXE Booting allow booting; allow bootp; ###... (17 Replies)
Discussion started by: hermouche
17 Replies

10. UNIX for Beginners Questions & Answers

Changes in dhcpd.conf do not make a difference in DHCP service behaviour

Hi Experts, Our DHCP server currently answers the DHCP Discover requests from ServerX. In our dhcpd.conf file there are parameters defined for ServerX. Now we introduced some additional Servers into the network and want them to get service from the same DHCP server. Similar configuration... (13 Replies)
Discussion started by: ekorgur
13 Replies
OCF_HEARTBEAT_DHCPD(7)						OCF resource agents					    OCF_HEARTBEAT_DHCPD(7)

NAME
ocf_heartbeat_dhcpd - Chrooted ISC DHCP server resource agent. SYNOPSIS
dhcpd [start | stop | monitor | meta-data | validate-all] DESCRIPTION
Manage an ISC DHCP server service in a chroot environment. SUPPORTED PARAMETERS
config The absolute path to the DHCP server configuration file. (unique, required, string, no default) chrooted Configure the dhcpd service to run in a chrooted or non-chrooted mode. (unique, optional, boolean, default true) chrooted_path The absolute path of the chrooted DHCP environment. (unique, optional, string, default "/var/lib/dhcp") binary The binary for the DHCP server process. An absolute path definition is not required, but can be used to override environment path. (optional, string, default "dhcpd") user The system user the DHCP server process will run as when it is chrooted. (optional, string, default "dhcpd") group The system group the DHCP server process will run as when it is chrooted. (optional, string, default "nogroup") interface The network interface(s) the DHCP server process will bind to. A blank value will bind the process to all interfaces. (optional, string, no default) includes This parameter provides a means to copy include files into the chrooted environment. If a dhcpd.conf file contains a line similar to this: include "/etc/named.keys"; Then an admin also has to tell the dhcpd RA that this file should be pulled into the chrooted environment. This is a space delimited list. (optional, string, no default) leases The leases database file, relative to chrooted_path. (optional, string, default "/db/dhcpd.leases") pid The path and filename of the PID file. It is relative to chrooted_path. (optional, string, default "/var/run/dhcpd.pid") SUPPORTED ACTIONS
This resource agent supports the following actions (operations): start Starts the resource. Suggested minimum timeout: 20. stop Stops the resource. Suggested minimum timeout: 20. monitor Performs a detailed status check. Suggested minimum timeout: 20. Suggested interval: 10. meta-data Retrieves resource agent metadata (internal use only). Suggested minimum timeout: 5. validate-all Performs a validation of the resource configuration. Suggested minimum timeout: 20. EXAMPLE
The following is an example configuration for a dhcpd resource using the crm(8) shell: primitive p_dhcpd ocf:heartbeat:dhcpd params config=string op monitor timeout="20" interval="10" depth="0" SEE ALSO
http://www.linux-ha.org/wiki/dhcpd_(resource_agent) AUTHOR
Linux-HA contributors (see the resource agent source for information about individual authors) resource-agents UNKNOWN 06/09/2014 OCF_HEARTBEAT_DHCPD(7)
All times are GMT -4. The time now is 10:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy