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
fi
}
time -f "\
Real time: %E\n\
User CPU: %U\n\
Sys CPU: %S\n\
Max memory: %M KB" backup
start_time=$(date +%s)
backup
end_time=$(date +%s)
exec_time=$((end_time - start_time))
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"
'';
};
};