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