#!/bin/bash date ma=`grep MemAvailable /proc/meminfo | awk '{print $2}'` echo MemAvailable = $ma runningloop=0 while true do ((runningloop=runningloop+1)) termname="darknet-running-${runningloop}" gnome-terminal -t $termname -- bash -c "bash ./darknet.sh" ma=`grep MemAvailable /proc/meminfo | awk '{print $2}'` ((ma=ma/1000)) echo MemAvailable = $ma MB while [ $ma -gt 2000 ] do date ma=`grep MemAvailable /proc/meminfo | awk '{print $2}'` ((ma=ma/1000)) echo MemAvailable = $ma MB sleep 1s done pkill darknet sleep 5s done