#!/bin/bash# The script is intended to sample (perform certain action, RUN EXPECT SCRIPT)# at an interval of 'sample_int' amount of time dring the peak hours,# and at an interval 'chk_int' amount of time, otherwise.lph=10;hph=3 #Lower/Higher limit on peak hourlpm=0;hpm=59 #Lower/Higher limit on peak minutelps=0;hps=59 #Lower/Higher limit on peak secondpeak=0chk_int=1m #Interval before checking for peak time; h stands for hourssample_int=15s #Sampling Interval ; m for minuteshour=`date +%k`;minute=`date +%M`;second=`date +%S`echo "time = $hour $minute $second" #this will show the time the script becomes active while !0 do #Check this condition always ad infinitum. while [$peak] do # While in peak time, 1.sample the network, 2.go to sleep for 15 minute echo "Ran the script" #RUN THE SAMPLING EXPECT SCRIPT sleep $sample_int #Sample after every 'sample_int' time peak=1 hour=`date +%k`;minute=`date +%M`;second=`date +%S` if[($lph -lt $hour -lt $hph) && ($lpm -lt $minute -lt $hpm) \ && ($lps -lt $second -lt$hps)] then peak=0; #If peak hour, them set variable peak as 'true'(i.e., = 0). fi done sleep $chk_int #Check for peak hout every 'chk_int' time echo "Ran the script" #RUN THE SAMPLING EXPECT SCRIPT hour=`date +%k`;minute=`date +%M`;second=`date +%S` if[($lph -lt $hour -lt $hph) && ($lpm<$minute<$hpm) && \ ($lps<$second<$hps)]; then #check if it is peak hour peak=0; # If peak hour, them set variable peak as 'true'(i.e., = 0). fi; doneecho "Oops, Broke the loop!"