sysinfo pipemenu update

master
Daniel Napora 2020-09-17 22:51:14 +02:00
parent 5525a7e7b0
commit a3cf9aac06
1 changed files with 8 additions and 14 deletions

View File

@ -1,11 +1,6 @@
#!/bin/bash #!/bin/bash
# jgsysinfo-pipe - native jgmenu pipemenu with some system informations # jgsysinfo-pipe - native jgmenu pipemenu with some system informations
# #
#settings
MountPoint1=/dev/sda1
MountPoint2=/dev/sdb1
NetworkDevice1=enp0s19f2u6
#settings
case $LANG in case $LANG in
pl*) pl*)
@ -60,23 +55,22 @@ Release=$(uname -r)
Arch=$(uname -m) Arch=$(uname -m)
Lsb_rel=$(lsb_release -rs) Lsb_rel=$(lsb_release -rs)
Lsb_code=$(lsb_release -cs) Lsb_code=$(lsb_release -cs)
SizeMountPoint1=$(df -HlT | grep "$MountPoint1") NetworkDevice1=$(ip route | grep default | sed -e "s/^.*dev.//" -e "s/.proto.*//")
SizeMountPoint2=$(df -HlT | grep "$MountPoint2")
NetDev1ip=$(ip address | grep '192.168' | awk '{ print $2}' | sed s:\/.*::g) NetDev1ip=$(ip address | grep '192.168' | awk '{ print $2}' | sed s:\/.*::g)
NetDev1down=$(/sbin/ifconfig "$NetworkDevice1" | grep "RX packets" |awk '{print $6}') NetDev1down=$(/sbin/ifconfig "$NetworkDevice1" | grep "RX packets" |awk '{print $6}')
NetDev1up=$(/sbin/ifconfig "$NetworkDevice1" | grep "TX packets" |awk '{print $6}' ) NetDev1up=$(/sbin/ifconfig "$NetworkDevice1" | grep "TX packets" |awk '{print $6}' )
MemTotal=$(echo "scale = 2; ("$(grep MemTotal: /proc/meminfo | awk '{print $2}' | sed 's/k//')" /1024)" | bc) MemTotal=$(echo "scale = 2; ("$(grep MemTotal: /proc/meminfo | awk '{print $2}' | sed 's/k//')" /1024)" | bc)
MemFree=$(echo "scale = 2; ("$(grep MemFree: /proc/meminfo | awk '{print $2}' | sed 's/k//')" /1024) + ("$(cat /proc/meminfo | grep grep -m 1 Cached: | awk '{print $2}' | sed 's/k//')" /1024)" | bc) MemFree=$(echo "scale = 2; ("$(grep MemFree: /proc/meminfo | awk '{print $2}' | sed 's/k//')" /1024) + ("$(grep -m 1 Cached: /proc/meminfo | awk '{print $2}' | sed 's/k//')" /1024)" | bc)
MemUsed=$(echo "scale = 2; ("$(grep MemTotal: /proc/meminfo | awk '{print $2}' | sed 's/k//')" /1024) - (("$(cat /proc/meminfo | grep MemFree: | awk '{print $2}' | sed 's/k//')" /1024) + ("$(cat /proc/meminfo | grep -m 1 Cached: | awk '{print $2}' | sed 's/k//')" /1024))" | bc) MemUsed=$(echo "scale = 2; ("$(grep MemTotal: /proc/meminfo | awk '{print $2}' | sed 's/k//')" /1024) - (("$(grep MemFree: /proc/meminfo | awk '{print $2}' | sed 's/k//')" /1024) + ("$(grep -m 1 Cached: /proc/meminfo | awk '{print $2}' | sed 's/k//')" /1024))" | bc)
SwpTotal=$(echo "scale = 2; ("$(grep SwapTotal: /proc/meminfo | awk '{print $2}' | sed 's/k//')" /1024)" | bc) SwpTotal=$(echo "scale = 2; ("$(grep SwapTotal: /proc/meminfo | awk '{print $2}' | sed 's/k//')" /1024)" | bc)
SwpFree=$(echo "scale = 2; ("$(grep SwapFree: /proc/meminfo | awk '{print $2}' | sed 's/k//')" /1024)" | bc) SwpFree=$(echo "scale = 2; ("$(grep SwapFree: /proc/meminfo | awk '{print $2}' | sed 's/k//')" /1024)" | bc)
SwpUsed=$(echo "scale = 2; ("$(grep SwapTotal: /proc/meminfo | awk '{print $2}' | sed 's/k//')" /1024) - ("$(cat /proc/meminfo | grep SwapFree: | awk '{print $2}' | sed 's/k//')" /1024)" | bc) SwpUsed=$(echo "scale = 2; ("$(grep SwapTotal: /proc/meminfo | awk '{print $2}' | sed 's/k//')" /1024) - ("$(cat /proc/meminfo | grep SwapFree: | awk '{print $2}' | sed 's/k//')" /1024)" | bc)
MemUsedPercent=$(echo "scale = 2; (("$(grep MemTotal: /proc/meminfo | awk '{print $2}' | sed 's/k//')" /1024) - (("$(cat /proc/meminfo | grep MemFree: | awk '{print $2}' | sed 's/k//')" /1024) + ("$(cat /proc/meminfo | grep -m 1 Cached: | awk '{print $2}' | sed 's/k//')" /1024))) / ("$(cat /proc/meminfo | grep MemTotal: | awk '{print $2}' | sed 's/k//')" /1024) *100" | bc) MemUsedPercent=$(echo "scale = 2; (("$(grep MemTotal: /proc/meminfo | awk '{print $2}' | sed 's/k//')" /1024) - (("$(grep MemFree: /proc/meminfo | awk '{print $2}' | sed 's/k//')" /1024) + ("$(grep -m 1 Cached: /proc/meminfo | awk '{print $2}' | sed 's/k//')" /1024))) / ("$(cat /proc/meminfo | grep MemTotal: | awk '{print $2}' | sed 's/k//')" /1024) *100" | bc)
SwpUsedPercent=$(echo "scale = 2; (("$(grep SwapTotal: /proc/meminfo | awk '{print $2}' | sed 's/k//')" /1024) - ("$(cat /proc/meminfo | grep SwapFree: | awk '{print $2}' | sed 's/k//')" /1024)) / ("$(cat /proc/meminfo | grep SwapTotal: | awk '{print $2}' | sed 's/k//')" /1024) *100" | bc) SwpUsedPercent=$(echo "scale = 2; (("$(grep SwapTotal: /proc/meminfo | awk '{print $2}' | sed 's/k//')" /1024) - ("$(grep SwapFree: /proc/meminfo | awk '{print $2}' | sed 's/k//')" /1024)) / ("$(grep SwapTotal: /proc/meminfo | awk '{print $2}' | sed 's/k//')" /1024) *100" | bc)
CPUmodel=$(grep -m 1 "model name" /proc/cpuinfo | sed 's/.*: //') CPUmodel=$(grep -m 1 "model name" /proc/cpuinfo | sed 's/.*: //')
CPUfreq=$(grep -m 1 "cpu MHz" /proc/cpuinfo | sed 's/.*: //') CPUfreq=$(grep -m 1 "cpu MHz" /proc/cpuinfo | sed 's/.*: //')
@ -128,7 +122,7 @@ out2+=("$(printf "<tt>%+29s</tt> %s" Uptime: "$UpTime")")
### RUN ### RUN
if [ $1 == "-s" ]; then if [ $1 == "-s" ]; then
. $HOME/bin/pipemenu-standalone.cfg . /usr/bin/pipemenu-standalone.cfg
MENU_PADDING_TOP=0 MENU_PADDING_TOP=0
MENU_HALIGN="center" MENU_HALIGN="center"
@ -138,7 +132,7 @@ mkconfigfile
cat <<EOF > ${MENU_ITEMS} cat <<EOF > ${MENU_ITEMS}
$(printf '%s\n' "${out[@]}") $(printf '%s\n' "${out[@]}")
$(df -HlT | grep -E '^/'|awk '{print "<tt>"$0"</tt>,pcmanfm "$7}') $(df -HlT | grep -E '^/'|awk '{print "\"\"\"<tt>"$0"</tt>\"\"\",pcmanfm "$7}')
$(printf '%s\n' "${out2[@]}") $(printf '%s\n' "${out2[@]}")
EOF EOF
@ -149,5 +143,5 @@ exit 0
fi fi
printf '%s\n' "${out[@]}" printf '%s\n' "${out[@]}"
df -HlT | grep -E '^/'|awk '{print "<tt>"$0"</tt>,pcmanfm "$7}' df -HlT | grep -E '^/'|awk '{print "\"\"\"<tt>"$0"</tt>\"\"\",pcmanfm "$7}'
printf '%s\n' "${out2[@]}" printf '%s\n' "${out2[@]}"