ddstatus.sh: re-check dd each loop so it exits when dd finishes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-29 14:59:00 -04:00
co-authored by Claude Opus 5.5
parent 9f6a5ef551
commit f962a1bac5
+10 -12
View File
@@ -6,22 +6,20 @@ PID=$(pidof dd)
main(){
if [ -z "${PID}" ];then
echo "DD is not running"
exit 0;
fi
while true;do
clear
if [ ! ${PID} ];then
echo "DD is not running"
exit 0;
elif [[ ${PID} ]];then
kill -USR1 ${PID} > /dev/null
sleep 1
if [[ ! ${PID} ]];then
echo "dd it no longer running"
exit 0;
fi
else
echo "There was an unknown error, exiting..."
PID=$(pidof dd)
if [ -z "${PID}" ];then
echo "dd is no longer running"
exit 0;
fi
kill -USR1 ${PID} > /dev/null 2>&1
sleep 1
done
}