I'm far from an expert so bear with me on this. I'm writing a script to check for check for active DHCP leases on each subnet configured on a server, and clear and restart DHCP if the usage is above 90%. The possible scope is /16 - /24.
/usr/share/flint/scripts/leasecheck.pl is a perl script that lists the DHCP leases across the server in a nice format, but doesn't differentiate by subnet (I didn't write this). So the bash script is to take that raw information and seperate it out. This is the easiest way I could think to do this, and it works, and does what I want, but not sure if there is a better or simpler way?
Without going into detailed analysis nor a deep understanding of what you are doing, twothree comments:
- the slashX functions differ only in one summand so could be boiled down into a single one with a parameter passed.
- a pipe organ like echo | grep | sed | awk | uniq | wc could almost certainly be boiled down to a single awk call.
- if the leasecheck.pl script is already available, why not expand it to do all the tasks?
- or create an overall awk script for the same reason.
Thanks for the insight RudiC. The first two suggestions sound like something I'll explore further. The perl script is available, but would require a lot more learning my side, but is something I'll definitely look in to longer term.
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)
#!/bin/bash
for digit in $(seq 1 10)
do
if ping -c1 -w2 192.168.1.$digit &> /dev/null
then
echo "192.168.1.$digit is UP"
else
echo "192.168.1.$digit is DOWN"
fi
done (3 Replies)
Hey guys,
currently I'm struggling with a little script to check an active URL in my running Firefox.
What I'm doing:
I'm running a low VPS with about 768mb RAM and Ubuntu on it. I only installed Fluxbox + Firefox to it in order to keep the resource consumption as low as possible. I think i... (8 Replies)
Hi,
I need to configure 4 ip address (same subnet and mask) in one ipmp group (two interfaces) in an active active formation (link based). Can some one provide the steps or a tutorial link.
Thanks (2 Replies)
is there a better way to check if a port is active on linux and sunos systems?
this is currently what I'm using in my script:
netstat -an | egrep -i "$PORT"
i know this isn't the best way as there could be numbers in that output that has my port number in it but isn't necessarily a... (0 Replies)
Hi all,
I am new to HACMP. So sorry for the newie question. But I did search the forum and it seems that no one asks this before.
So if a 2-node cluster runs in active-active mode (and the same application), what is the benefit of using HACMP ?
If it runs in active-stanby, it is easy to... (9 Replies)
Hello,
I have created program that run threads one by one, maximum 100. Each thread will process one block of data, and once it`s finished, new thread is created with new block of data....etc
I have array of values to control status of each thread, like this:
array_thread_status=1... (11 Replies)