diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2018-04-16 10:30:15 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2018-04-16 10:30:15 +0200 |
commit | 55783753ae8f2d857a7225b7a93c1d47039e5a90 (patch) | |
tree | e077b61b0f004141712e7d16876f9c19175ac681 /scripts/emerge-current.sh | |
download | conky-55783753ae8f2d857a7225b7a93c1d47039e5a90.tar.gz conky-55783753ae8f2d857a7225b7a93c1d47039e5a90.tar.bz2 conky-55783753ae8f2d857a7225b7a93c1d47039e5a90.tar.xz conky-55783753ae8f2d857a7225b7a93c1d47039e5a90.zip |
OpenShift monitoring
Diffstat (limited to 'scripts/emerge-current.sh')
-rwxr-xr-x | scripts/emerge-current.sh | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/scripts/emerge-current.sh b/scripts/emerge-current.sh new file mode 100755 index 0000000..53e7a19 --- /dev/null +++ b/scripts/emerge-current.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# emerge-current.sh by Hellf[i]re +# +# This script is designed to read the name of the last package compiled. +# +# As this script does read the entirety of emerge.log, it will be rather +# heavy on the CPU. It shouldn't be enough to be noticable on newer (2.0Ghz+) +# processors, but it still should not be run more often than every 30 seconds. +# +# Usage: +# .conkyrc: ${execi [time] /path/to/script/emerge-current.sh} +# +# Usage Example +# ${execi 30 /home/youruser/scripts/emerge-current.sh} + +if [ -n "$1" ]; then + num=$1 +else + num=1 +fi + +tac /var/log/emerge.log |\ +grep 'Compiling' |\ +head -n $num |\ +sed -e 's/.*(//' |\ +sed -e 's/::.*)//' |\ +sed -e '2,$ { s|^[^/]\+/|| }' |\ +sed -e '2,$ { s|-[0-9.]\+\(-r[0-9]\+\)\?$|| }' |\ +head -n $num | sed -e "2 { s/^/ / }" -e "2,$ { :a ; N ; s/\n/, /; ta }" |\ +cut -d \) -f 1 + + + |