Line in bash script to wait for x feedbacks and then continue
I have a script that runs a console/terminal command on the server and what is want is for each of the multiple success reports fed back from the clients (echo-ed out onto the conosle) to be counted and after x number of reports reboot the server.
The Details:
The command (program) is clonezilla and in one line of the script it kicks off a job to roll out an image to a bunch of PCs. As the PCs are finished being imaged they report back to the clonezilla server (Ubuntu) by echo-ing a line on the script console/terminal to report the success and the time it took to image each partition on the drive.
I had a counter in the script that just counted down 20 minutes and then stoped the DHCP server. It also prevented the script terminal from closing and the reports from being visible. It was nice to see the reports but more important to stop the DHCP server. I really want the script to wait for the clients to report back and then reboot the server.
The DHCP server that temporarily runs on the Ubuntu clonezilla server (for PXE boot) interferes with the production DHCP server, which has reserved IP addresses based on the client MAC addresses (it is also the gateway for the clients). So I want the image server to reboot (dual boot, so boots back to XP (default)) so that the DHCP servers do not conflict and the clone server is 'hidden'.
If anyone knows how I can block the server from seeing the default gateway/firewall on layer two then that would be a bonus. Right now I have to physically unplug the network cable to prevent the multicast image job from running super slow and stay at the 3 to 4GB per minute as it does. IP tables didn't work.
Here is the whole script including the last line, which I think may work and do what I want but I am hoping to get a confirmation and the best way to do this. I am looking to learn more bash scripting too.
I thought about about a while loop.
Here is an example of the line echo-ed back when I client is finished cloning.
Hello,
im creating a csv file for email reporting on issues.
my problem is that after 'continue' command in if statment in a loop
the new paramter writing into the log doesnt take new line.
timeout 4s zabbix_get -I $ZBX -p $PORT -s $IP -k "system.run"
if ; then
... (3 Replies)
hi all,
i want to make a bash script so it can monitor directory sizes ie if it stays the same size (for a certain time) i want it to run the script but if there still copying and the directory increases in size do not run the script
i have heard "inotifywait" can do this, but theres... (7 Replies)
Hello,
I'm works on Ubuntu server
My goal : I would like to read file line per line, but i want to started at the end of file.
Currently, I use instructions :
while read line;
do
COMMAND
done < /var/log/apache2/access.log
But, the first line, i don't want this. The file is long... (5 Replies)
Hi All,
Am trying to write wrapper shell/bash script on a utility tool for which i need to pass 2 files as arugment to execute utility tool.
Wraper script am trying is to do with above metion 2 files.
utility tool accepts :
a. userinfo file : which contains username
b. item file : which... (2 Replies)
Hello,
im having bash script with
while ***
command1 &&
command2 &&
command3 &&
done
i want to ask how i can prevent overloading server, by waiting untill all commands complete? any low resources intensive command like "wait" - i dont know if exist? (2 Replies)
Hi,
I am facing a strange issue,
when i call a script from my while loop in background it doesnt go in background, despite the wait i put below the whil loop it goes forward even before the process put in background is completed.
cat abc.txt | while read -u4 line
do
#if line contains #... (2 Replies)
Hello,
I have a very long instruction to write, but, for lisibility reasons, I would like to cut it on more than one line and comment each lines.
is it possible ?
thanks :b: (1 Reply)
HI ,
I am new to the perl , I am using a if condition and in that if condition i am checking 7 variables value. so it continue to second line .And if i user "\" for the continue line it showing error.
Example :
if(a >9 || b>8 || c> 10 \
d > 11)
{
print();
}
The above statement is... (3 Replies)