[X2Go-Commits] [maintenancescripts] 01/01: killstalevms.bash: get VMs, get builder PIDs.
git-admin at x2go.org
git-admin at x2go.org
Wed Feb 11 23:25:25 CET 2015
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository maintenancescripts.
commit 81fa0374ba10ee6f91fbb21be796c6be53202d82
Author: Mihai Moldovan <ionic at ionic.de>
Date: Wed Feb 11 23:25:20 2015 +0100
killstalevms.bash: get VMs, get builder PIDs.
---
killstalevms.bash | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/killstalevms.bash b/killstalevms.bash
new file mode 100644
index 0000000..b1761a5
--- /dev/null
+++ b/killstalevms.bash
@@ -0,0 +1,25 @@
+#/bin/bash
+
+set -x
+
+typeset -a VM_LIST
+typeset -i i
+
+i=0
+
+pgrep -f -u root '^kvm.*pbuilder.*qemu.*' | while read VM_PID; do
+ VM_LIST[$((i++))]="${VM_PID}"
+done
+
+typeset -a BUILDER_LIST
+
+for ((i = 0; i < ${#VM_LIST[@]}; ++i)); do
+ BUILDER_LIST[$i]="$(perl -pe 's/.*?qemu\.(\d+)\.dev.*/\1/' < /proc/${VM_LIST[$i]}/cmdline)"
+done
+
+typeset -a COMPONENT_LIST BRANCH_LIST SYSTEM_LIST
+
+for ((i = 0; i < ${#BUILDER_LIST[@]}; ++i)); do
+ TMP_CMDLINE="$(< /proc/${BUILDER_LIST[$i]}/cmdline)"
+ COMPONENT_LIST[$i]="$(perl -pe 's///' <<< "${TMP_CMDLINE}")"
+done
--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/maintenancescripts.git
More information about the x2go-commits
mailing list