Script to create DHCP report


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to create DHCP report
# 1  
Old 07-24-2015
Script to create DHCP report

Hi,

In our company, we have been asked to design a script to automate the report of all IP's which are free/used from all the pools in DHCP at any given Amount of time. We have prepare the following script. The problem is when we run the script manually from the command prompt, it brings proper results, but when the same is run via cron daemon, the results come distorted in different lines. Following is the script. Please, suggest something. I believe the issue is of Environment variable, but i cant figure out how to resolve it

Code:
#!/bin/bash

/usr/local/bin/dhcpstatus>/report/dhcpreport.log
/usr/local/bin/dhcpstatus|awk '{print $9,",",$11,",",$14,",",$17}'>/report/dhcpreport01.log
grep 1 /report/dhcpreport01.log>/report/dhcpreport03.log
cat /report/dhcpreport03.log | sed "s/^/ `date +"%Y%m%d%H%M",`/">/report/dhcpreport04.csv

# 2  
Old 07-24-2015
Please show us the OK results and the distorted ones so we have a chance to track down the problem.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to create a report using paste or with awk

Input file will be Name: serve1 has disk :Yes dev (8): Name: serve2 has disk :No dev (8): Name: serve3 has disk :No Name: serve4 has disk :Yes dev (8): Need output like that. I was using pate -d, - - - . But that need all the line in same format in this some server it has... (4 Replies)
Discussion started by: ranjancom2000
4 Replies

2. Shell Programming and Scripting

Need to develop a bash script to create customized report from the server log

Hi, I need to develop a bash script to create customized report from the server log (red hat 5.8 64 bit Operating system). The following is one of the log for our internal application task. <2015.03.03 20:09:52 274 +0800><I><DSCTH01><http-0.0.0.0-443-2><security> GUI request succeeded for... (1 Reply)
Discussion started by: pugazhendhi_r
1 Replies

3. IP Networking

Get DHCP relay interfaces IP address using DHCP

Hi All , please view the set up below: ------------------------------------------------------------------- | DHCP Server |-----------| ROUTER & |-----------| Clients | | 192.168.99.1 | - -<eth1>| DHCP-RELAY|<eth2>-- | 192.168.88.X | ... (2 Replies)
Discussion started by: gdangoor
2 Replies

4. Shell Programming and Scripting

New To UNIX - Need Script to create report of user & group accounts

Hi, I'm new to the world of UNIX and have been asked to create a complex script (at least complex to me:confused:) for AIX UNIX to create a report of all the users on the server including server, user, UID, groups, GID, etc. Found a script using lsuser, but the output is still lacking. 2 things I... (2 Replies)
Discussion started by: panthur
2 Replies

5. IP Networking

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... (5 Replies)
Discussion started by: bypper
5 Replies

6. Homework & Coursework Questions

Create script to add user and create directory

first off let me introduce myself. My name is Eric and I am new to linux, I am taking an advanced linux administration class and we are tasked with creating a script to add new users that anyone can run, has to check for the existence of a directory. if the directory does not exist then it has... (12 Replies)
Discussion started by: pbhound
12 Replies

7. Shell Programming and Scripting

Need to develop a script to create a report reading multiple server logs

I am currently trying to develop a script to connect to mulltiple servers, reading specifc data from log files on the servers and append the data from each file into a single tab delimited row. So, at the end I am planning to have a report with all the extracted data with each row per server. I am... (5 Replies)
Discussion started by: scriptingnewbie
5 Replies

8. Homework & Coursework Questions

shell script that can create, monitor the log files and report the issues for matching pattern

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Write an automated shell program(s) that can create, monitor the log files and report the issues for matching... (0 Replies)
Discussion started by: itian2010
0 Replies

9. Shell Programming and Scripting

create a report using shell

hi suppose I want to create a report where it will shows the machine name, the date & time when the report is produced. can anyone please help me to write such shell script? requesting all. Thanks (10 Replies)
Discussion started by: moco
10 Replies

10. Shell Programming and Scripting

help with awk to create report

Hi, I am trying to create a report using the following syntax: #!/bin/awk -f #script name: users_report BEGIN { FS=":" ; OFS="\t" ; print "User\tGID\tUser Name\tHome Dir\t" { print $1 , $3 , $5 , $6 } END { print "\n End of Report \n" } $> user_report /etc/passwd the output of... (5 Replies)
Discussion started by: ghazi
5 Replies
Login or Register to Ask a Question