Commit cb0fc5d1 authored by Olav Kvittem's avatar Olav Kvittem
Browse files

added check for load

parent 98013462
#!/bin/bash
#Starts analyzing 24 hours of files
#Correct input is ./atlas-gap-ana 2021-03-05
#Correct input is ./atlas-gap_ana 2021-03-05
#if you want that particular date
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
maxload=$( lscpu | awk '/^CPU\(s\)/{print $2;exit 0}' )
check_load(){
load=$(awk '{printf "%d",$1}' /proc/loadavg)
while test $load -gt $maxload; do
date "+%T slowdown with $njobs jobs and $load load"
sleep 60 # for all detached jobs to finish
load=$(awk '{printf "%d",$1}' /proc/loadavg)
done
}
#Checks to see if files are already downloaded or loaded
if [ -f "log/$1-loaded" ];
then exit
then exit
fi
if [ -f "log/$1T0000-finished" ];
then exit
then exit
fi
#Checks to see if files are ready on RIPE Atlas server
#Checks to see if files are on RIPE Atlas server
for i in {0..23}
do
if [ $i -lt 10 ]
then
j=0${i}
j=0${i}
else
j=${i}
fi
if ! wget --spider \
"https://data-store.ripe.net/datasets/atlas-daily-dumps/${1}/traceroute-${1}T${j}00.bz2" \
2>/dev/null;
2>/dev/null;
then
exit
fi
......@@ -47,6 +55,6 @@ do
else
j=${i}
fi
python $SCRIPT_DIR/atlas-gap-ana.py ${1}T${j}00 &
check_load
nice python atlas-gap-ana.py ${1}T${j}00 &
done
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment