add basic stat monitoring to backup script

This commit is contained in:
2025-10-13 17:35:54 -05:00
parent 30302af17b
commit ba38794ef4

View File

@@ -124,11 +124,15 @@ in
exit 0 exit 0
fi fi
} }
time -f "\ start_time=$(date +%s)
Real time: %E\n\ backup
User CPU: %U\n\ end_time=$(date +%s)
Sys CPU: %S\n\ exec_time=$((end_time - start_time))
Max memory: %M KB" backup cpu_usage=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}')
echo ""
echo "backup stats:"
echo "exec time: $exec_time"
echo "cpu usage: $cpu_usage"
''; '';
}; };
}; };