summaryrefslogtreecommitdiffstats
path: root/scripts/emerge-progress.sh
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2018-04-16 10:30:15 +0200
committerSuren A. Chilingaryan <csa@suren.me>2018-04-16 10:30:15 +0200
commit55783753ae8f2d857a7225b7a93c1d47039e5a90 (patch)
treee077b61b0f004141712e7d16876f9c19175ac681 /scripts/emerge-progress.sh
downloadconky-55783753ae8f2d857a7225b7a93c1d47039e5a90.tar.gz
conky-55783753ae8f2d857a7225b7a93c1d47039e5a90.tar.bz2
conky-55783753ae8f2d857a7225b7a93c1d47039e5a90.tar.xz
conky-55783753ae8f2d857a7225b7a93c1d47039e5a90.zip
OpenShift monitoring
Diffstat (limited to 'scripts/emerge-progress.sh')
-rwxr-xr-xscripts/emerge-progress.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/emerge-progress.sh b/scripts/emerge-progress.sh
new file mode 100755
index 0000000..1f28f73
--- /dev/null
+++ b/scripts/emerge-progress.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+# source: Jeremy_Z @ forums.gentoo.org http://forums.gentoo.org/viewtopic-t-351806-postdays-0-postorder-asc-start-550.html
+#
+# This script will report the progress of the last emerge command run. It
+# reports the TOTAL percentage complete - not the percentage of the current
+# package. For example, if there are 110 packages currently being emerged, and
+# it is on the 55th package, it will report 50.
+#
+# Usage:
+# .conkyrc: ${execibar [time] /path/to/script/emerge-progress.sh}
+#
+# Usage Example
+# ${execibar 30 /home/youruser/scripts/emerge-progress.sh}
+
+tail -n 50 /var/log/emerge.log |\
+tac |\
+grep -v "Starting retry" |\
+grep -iE '([0-9]* of [0-9]*)' -o -m 1 |\
+sed -e 's/\(.*\) of \(.*\)/\1 \2/' |\
+awk '{print 100.0*$1/$2}'