aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2010-01-09 10:42:27 -0500
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>2010-01-09 10:42:27 -0500
commita9769800e9bf345bddfdeb619c50eaf72b85f0bb (patch)
tree72780a348b83f9faaed8b6eec00c055877a644fa
parent64f1b41721fbafd379f8fc5453861088449c3ba1 (diff)
parent3873c791e3c1c1b9f5696085671180c6182224ee (diff)
downloadkvm-manager-a9769800e9bf345bddfdeb619c50eaf72b85f0bb.tar.gz
kvm-manager-a9769800e9bf345bddfdeb619c50eaf72b85f0bb.tar.bz2
Merge commit '3873c791e3c1c1b9f5696085671180c6182224ee'
-rw-r--r--.gitignore1
-rwxr-xr-xkvm-status27
2 files changed, 28 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index b25c15b..4d6f936 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
*~
+*.iso
diff --git a/kvm-status b/kvm-status
new file mode 100755
index 0000000..9a2c6fc
--- /dev/null
+++ b/kvm-status
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+dir=/etc/sv/kvm
+
+function convert_ram {
+ display_ram=
+ ram=$(echo "$1" | tr [:upper:] [:lower:])
+ label=$(echo $ram| tr -d "[0-9]+")
+ value=${ram%$label}
+ if [ -z "$label" ] || [ "$label" = "mb" ]; then
+ display_ram=$value
+ else
+ display_ram=$(( $value * 1024 ))
+ fi
+}
+
+{
+ echo "SERVER RAM"
+ total_ram=0
+ for foo in $(ls $dir); do
+ ram=$(cat $dir/$foo/env/RAM)
+ convert_ram "$ram"
+ echo "$foo $display_ram"
+ total_ram=$(( $total_ram + $display_ram ))
+ done
+ echo "TOTAL $total_ram"
+} | column -t