All of lore.kernel.org
 help / color / mirror / Atom feed
* [yocto-autobuilder][PATCH] cleanup and restart crashed vnc server
@ 2016-08-17  0:09 Bill Randle
  2016-08-17 15:59 ` Joshua G Lock
  0 siblings, 1 reply; 6+ messages in thread
From: Bill Randle @ 2016-08-17  0:09 UTC (permalink / raw)
  To: yocto

Use a common script to check for a running vnc server, and if not running
cleanup dangling lock files and restart the server.

[YOCTO #8210]

Signed-off-by: Bill Randle <william.c.randle@intel.com>
---
 bin/checkvnc                                                   | 10 ++++++++++
 .../site-packages/autobuilder/buildsteps/RunESDKSanityTests.py |  3 +--
 .../site-packages/autobuilder/buildsteps/RunOeSelftest.py      |  3 +--
 .../site-packages/autobuilder/buildsteps/RunSDKSanityTests.py  |  3 +--
 .../site-packages/autobuilder/buildsteps/RunSanityTests.py     |  3 +--
 5 files changed, 14 insertions(+), 8 deletions(-)
 create mode 100755 bin/checkvnc

diff --git a/bin/checkvnc b/bin/checkvnc
new file mode 100755
index 0000000..574ba48
--- /dev/null
+++ b/bin/checkvnc
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# check if vnc server is running, and if not, cleanup and restart
+#
+pid=$(pidof Xvnc)
+if [[ $? != 0 ]]; then
+    echo "Xvnc not running, attempting restart"
+    vncserver -kill :1
+    vncserver
+fi
diff --git a/lib/python2.7/site-packages/autobuilder/buildsteps/RunESDKSanityTests.py b/lib/python2.7/site-packages/autobuilder/buildsteps/RunESDKSanityTests.py
index 7471d3d..c16c8c2 100644
--- a/lib/python2.7/site-packages/autobuilder/buildsteps/RunESDKSanityTests.py
+++ b/lib/python2.7/site-packages/autobuilder/buildsteps/RunESDKSanityTests.py
@@ -47,8 +47,7 @@ class RunESDKSanityTests(BitbakeShellCommand):
         layerversion = self.getProperty("layerversion_core")
         command = ""
         command = command + ". ./oe-init-build-env; "
-        command = command + "netstat -an | grep -q 5901 ;"
-        command = command + 'if [ $? -ne 0 ]; then echo "Starting a VNC server on :1"; vncserver :1; else echo "Will use a VNC server already running on :1"; fi;'
+        command = command + "checkvnc; "
         if layerversion and int(layerversion) >= 7:
             command = command + "echo 'INHERIT += \"testsdk\"' >> ./conf/auto.conf;"
             command = command + "echo 'TEST_QEMUBOOT_TIMEOUT = \"1500\"' >> ./conf/auto.conf;"
diff --git a/lib/python2.7/site-packages/autobuilder/buildsteps/RunOeSelftest.py b/lib/python2.7/site-packages/autobuilder/buildsteps/RunOeSelftest.py
index 809bcc3..84d32fe 100644
--- a/lib/python2.7/site-packages/autobuilder/buildsteps/RunOeSelftest.py
+++ b/lib/python2.7/site-packages/autobuilder/buildsteps/RunOeSelftest.py
@@ -31,8 +31,7 @@ class RunOeSelftest(ShellCommand):
     def start(self):
         self.command = ""
         self.command += ". ./oe-init-build-env; "
-        self.command += "netstat -an | grep -q 5901 ;"
-        self.command += "if [ $? -ne 0 ]; then echo 'Starting a VNC server on :1'; vncserver :1; else echo 'Will use a VNC server already running on :1'; fi;"
+        self.command += "checkvnc; "
         if self.tests == None:
             self.command += "if [ -d ../meta-selftest ]; then export DISPLAY=:1; oe-selftest --run-all-tests; else echo 'Skipping step - no meta-selftest layer here'; fi"
         else:
diff --git a/lib/python2.7/site-packages/autobuilder/buildsteps/RunSDKSanityTests.py b/lib/python2.7/site-packages/autobuilder/buildsteps/RunSDKSanityTests.py
index 9b6eb5b..6fb3127 100644
--- a/lib/python2.7/site-packages/autobuilder/buildsteps/RunSDKSanityTests.py
+++ b/lib/python2.7/site-packages/autobuilder/buildsteps/RunSDKSanityTests.py
@@ -47,8 +47,7 @@ class RunSDKSanityTests(BitbakeShellCommand):
         layerversion = self.getProperty("layerversion_core")
         command = ""
         command = command + ". ./oe-init-build-env; "
-        command = command + "netstat -an | grep -q 5901 ;"
-        command = command + 'if [ $? -ne 0 ]; then echo "Starting a VNC server on :1"; vncserver :1; else echo "Will use a VNC server already running on :1"; fi;'
+        command = command + "checkvnc; "
         if layerversion and int(layerversion) >= 6:
             command = command + "echo 'INHERIT += \"testimage\"' >> ./conf/auto.conf;"
             command = command + "echo 'TEST_QEMUBOOT_TIMEOUT = \"1500\"' >> ./conf/auto.conf;"
diff --git a/lib/python2.7/site-packages/autobuilder/buildsteps/RunSanityTests.py b/lib/python2.7/site-packages/autobuilder/buildsteps/RunSanityTests.py
index 4fa6dac..81e20cd 100644
--- a/lib/python2.7/site-packages/autobuilder/buildsteps/RunSanityTests.py
+++ b/lib/python2.7/site-packages/autobuilder/buildsteps/RunSanityTests.py
@@ -48,8 +48,7 @@ class RunSanityTests(BitbakeShellCommand):
         distro = self.getProperty("DISTRO")
         command = ""
         command = command + ". ./oe-init-build-env; "
-        command = command + "netstat -an | grep -q 5901 ;"
-        command = command + 'if [ $? -ne 0 ]; then echo "Starting a VNC server on :1"; vncserver :1; else echo "Will use a VNC server already running on :1"; fi;'
+        command = command + "checkvnc; "
         if distro == "poky-lsb" and layerversion and int(layerversion) < 6:
             command = "echo 'Skipping step.'"
         elif layerversion and int(layerversion) > 1:
-- 
2.5.5



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-08-31 20:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-17  0:09 [yocto-autobuilder][PATCH] cleanup and restart crashed vnc server Bill Randle
2016-08-17 15:59 ` Joshua G Lock
2016-08-17 16:09   ` Randle, William C
2016-08-17 16:12     ` Joshua G Lock
2016-08-18  1:41       ` Randle, William C
2016-08-31 20:26       ` Joshua Lock

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.