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:
+10
-12
@@ -6,22 +6,20 @@ PID=$(pidof dd)
|
|||||||
|
|
||||||
main(){
|
main(){
|
||||||
|
|
||||||
|
if [ -z "${PID}" ];then
|
||||||
|
echo "DD is not running"
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
|
|
||||||
while true;do
|
while true;do
|
||||||
clear
|
clear
|
||||||
if [ ! ${PID} ];then
|
PID=$(pidof dd)
|
||||||
echo "DD is not running"
|
if [ -z "${PID}" ];then
|
||||||
exit 0;
|
echo "dd is no longer running"
|
||||||
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..."
|
|
||||||
exit 0;
|
exit 0;
|
||||||
fi
|
fi
|
||||||
|
kill -USR1 ${PID} > /dev/null 2>&1
|
||||||
|
sleep 1
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user