#!/bin/bash # Crude Folding@home watching scripts # Author: Royce Williams / @TychoTithonus # License: Public domain # Written: 2020-03 FAHLOG=/var/lib/fahclient/log.txt ALIGN=$(which align) FREQCOUNT=$(which freqcount) NVIDIASMI=$(which nvidia-smi) if [ ! -x "${ALIGN}" ]; then echo "Uses align utility: see http://kinzler.com/me/align/" exit 1 fi if [ ! -x "${FREQCOUNT}" ]; then echo "Uses freqcount utility: see http://www.brendangregg.com/Perl/freqcount" exit 1 fi if [ ! -x "${NVIDIASMI}" ]; then echo "Uses nvidia-smi utility" exit 1 fi while true; do clear; top -b -n 1 | egrep '^top|Fah|FAH|Mem :' | head -n 10; ${NVIDIASMI} | egrep 'Default|Fah'; echo "------------------------------------------------------------------------------" tail -n 2000 ${FAHLOG} \ | egrep -v 'Folding@home Core Shutdown|Download complete|Assigned to work server|:Unit: 0|Downloading [0-9]|Download [0-9]|\-gpu [0-9]|Saving result file|Folding@home GPU Core21|Folding@home GPU Core22 Folding@home Core|Upload complete|Log Started|Connecting to|Starting$|Started FahCore on PID|ignatures verified|Version|Cleaning|Upload [0-9]|Completed|Reading tar|(Type|CPUs|Memory|Threads|Battery|Offset|PID|CWD|OS|Arch|Repository|Revision|Branch|Compiler|Options|Bits|Mode|ID|Config|Date|Time|Website|Copyright|Author|CPU|Core):|\* (Build|System) \*|Core22 Folding@home Core|chodera|WORK_ACK|FINISHED_UNIT|opencl-device|:\*|:Machine:' \ | tr -s ' ' | tr -s '*' | tr -s '0'\ | sed 's/ Requirements: single Nvidia GPU, tmax must be < 110 and twait >= 90//g;s/Sending unit results: /Snd: /g;s/id:/i:/g;s/state:/s:/g;s/error:/e:/g;s/project:/p:/g;s/run:/r:/g;s/clone:/c:/g;s/gen:/g:/g;s/core:/c:/g;s/unit:/u:/g;s/DOWNLOAD/DL/g;s/SEND/SN/g;s/NO_ERROR/NO/g;s/Requesting new work unit for slot /Req s/g;s/Received Unit:/Rcv:/g;s/WU0/W/g;s/FS0/F/g' \ | tail -n 21 echo "------------------------------------------------------------------------------" tail -n 50 ${FAHLOG} | egrep Completed | tail -n 9 | ${ALIGN} tail -n 2000 ${FAHLOG} \ | egrep -v 'Completed' \ | grep Project \ | cut -d\: -f7- \ | cut -d\ -f1-2 \ | ${FREQCOUNT} \ | sed 's/Project://g' \ | xargs sleep 30; done