add basic stat monitoring to backup script
This commit is contained in:
@@ -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"
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user