Skip to content

Commit

Permalink
Merge pull request #8 from robertpeteuil/develop
Browse files Browse the repository at this point in the history
Add Swap Reporting from PR
  • Loading branch information
robertpeteuil authored Dec 30, 2023
2 parents dc7c9f1 + d69d15e commit e57794d
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions sysis
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

# sysis - Display Key System Information
# Copyright (C) 2014-2022 Robert Peteuil @RobertPeteuil
# Copyright (C) 2014-2023 Robert Peteuil @RobertPeteuil
#
# Lightweight Cross-Platform Utility for:
# macOS, Linux, and Windows 10 Bash on Windows
Expand All @@ -10,8 +10,8 @@


scriptname="sysis"
scriptbuildnum="3.7.25"
scriptbuilddate="2023-09-13"
scriptbuildnum="3.8.0"
scriptbuilddate="2023-12-30"

############################################################
### VARS INITS
Expand Down Expand Up @@ -383,6 +383,13 @@ setRPI() {
MEMuse=$(free -m | awk 'NR==2{printf "%s/%s MB", $3,$2 }')
MemRatio=$(free -m | awk 'NR==2{printf "%.0f\n", $3*100/$2 }')
MEMusage="${MEMuse} ${CLRnormal}${CLRwarning}(${MemRatio}%)${CLRnormal}"
swapUse="$(free -m | awk 'NR==3{printf "%s/%s MB", $3,$2}')"
if [ "$(free -m | awk 'NR==3{printf "%.0f\n", $2}')" == 0 ]; then
swapRatio="0"
else
swapRatio="$(free -m | awk 'NR==3{printf "%.0f\n", $3*100/$2'})"
fi
swapUsage="${swapUse} ${CLRnormal}${CLRwarning}(${swapRatio}%)${CLRnormal}"
fi
return 0
}
Expand All @@ -406,6 +413,13 @@ setLinux() {
MEMuse=$(free -m | awk 'NR==2{printf "%s/%s MB", $3,$2 }')
MemRatio=$(free -m | awk 'NR==2{printf "%.0f\n", $3*100/$2 }')
MEMusage="${MEMuse} ${CLRnormal}${CLRwarning}(${MemRatio}%)${CLRnormal}"
swapUse="$(free -m | awk 'NR==3{printf "%s/%s MB", $3,$2}')"
if [ "$(free -m | awk 'NR==3{printf "%.0f\n", $2}')" == 0 ]; then
swapRatio="0"
else
swapRatio="$(free -m | awk 'NR==3{printf "%.0f\n", $3*100/$2'})"
fi
swapUsage="${swapUse} ${CLRnormal}${CLRwarning}(${swapRatio}%)${CLRnormal}"
fi
return 0
}
Expand Down Expand Up @@ -592,6 +606,7 @@ reportSystem() {
[[ -n $HWrelease ]] && echo -e "\t${CLRtitle}Release Date\t${CLRdefault}${HWrelease}${CLRnormal}"
[[ -n $CPUmeta ]] && echo -e "\t${CLRtitle}Processor\t${CLRdefault}${CPUmeta}${CLRnormal}"
[[ -n $MEMusage ]] && echo -e "\t${CLRtitle}Memory Use\t${CLRdefault}${MEMusage}${CLRnormal}"
[[ -n $swapUsage ]] && echo -e "\t${CLRtitle}Swap Use\t${CLRdefault}${swapUsage}${CLRnormal}"
[[ -n $DISKusage ]] && echo -e "\t${CLRtitle}Disk Use\t${CLRdefault}${DISKusage}${CLRnormal}"
return 0
}
Expand Down

0 comments on commit e57794d

Please sign in to comment.