while [ 1 ] do lsof | grep $log_file > /dev/null 2>&1 sleep 60 echo $? if [ "$?" = "1" ] then echo "$log_file is currently not in use!" break fi done