From 58a1793cb75603829a480e9f0ddc859820198a06 Mon Sep 17 00:00:00 2001 From: Anil Belur Date: Fri, 9 Jun 2017 13:42:51 +1000 Subject: [PATCH] Report memory usage with sys-info Earlier this was getting printed in the end of the console logs which got missed out while porting to lftools. Change-Id: Id7e59ecdc017c15ebbe1d540fa36eef19ced9d38 Co-Authored-By: Thanh Ha Signed-off-by: Anil Belur Signed-off-by: Thanh Ha --- shell/deploy | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/shell/deploy b/shell/deploy index 9ec165b7..fb826eaa 100755 --- a/shell/deploy +++ b/shell/deploy @@ -192,12 +192,24 @@ deploy_logs() { # Print system info before collecting logs touch "_sys-info.log" { - echo -e "---> uname -a:\n $(uname -a) \n" - echo -e "---> lscpu:\n $(lscpu) \n" - echo -e "---> nproc:\n $(nproc) \n" - echo -e "---> df -h:\n $(df -h) \n" - echo -e "---> free -m:\n $(free -m) \n" - echo -e "---> ip addr:\n $(/sbin/ip addr) \n" + local sys_cmds + sys_cmds=( + "uname -a" + "lscpu" + "nproc" + "df -h" + "free -m" + "ip addr" + "sar -r" + ) + for cmd in "${sys_cmds[@]}"; do + # If command exists then print output. + set -- $cmd + hash $1 2> /dev/null + if [ "$?" -eq "0" ]; then + echo -e "---> $cmd:\n $($cmd) \n" + fi + done } 2>&1 | tee -a "_sys-info.log" # Magic string used to trim console logs at the appropriate level during wget -- 2.16.6