Patchwork [bitbake-devel,54/94] bitbake: webhob: clean up starting script

login
register
mail settings
Submitter Alexandru DAMIAN
Date Sept. 24, 2013, 4:52 p.m.
Message ID <b8ff22ca8a106fdca59a959bbeba31f10fc678fb.1380041477.git.alexandru.damian@intel.com>
Download mbox | patch
Permalink /patch/58743/
State New
Headers show

Comments

Alexandru DAMIAN - Sept. 24, 2013, 4:52 p.m.
From: Alexandru DAMIAN <alexandru.damian@intel.com>

Clean up of webhob start-up script as to make sure
it aborts the startup on database errors, and
that it doesn't execute superflous kill commands when
stopping.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
---
 bitbake/bin/webhob | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Patch

diff --git a/bitbake/bin/webhob b/bitbake/bin/webhob
index 099f2d3..aa35294 100755
--- a/bitbake/bin/webhob
+++ b/bitbake/bin/webhob
@@ -39,9 +39,13 @@  function webserverKillAll()
 
 function webserverStartAll()
 {
-        python $BBBASEDIR/lib/webhob/manage.py syncdb || (echo "Failed db sync, stopping system start" 1>&2 && return 2)
+        retval=0
+        python $BBBASEDIR/lib/webhob/manage.py syncdb || retval=1
+        if [ $retval -eq 1 ]; then
+                echo "Failed db sync, stopping system start" 1>&2
+        fi
         python $BBBASEDIR/lib/webhob/manage.py runserver </dev/null >${BUILDDIR}/whbmain.log 2>&1 & echo $! >${BUILDDIR}/whbmain.pid
-        return 0
+        return $retval
 }
 
 
@@ -125,7 +129,7 @@  case $CMD in
         unset BBSERVER
         webserverKillAll
         # force stop any misbehaving bitbake server
-        lsof bitbake.lock | awk '{print $2}' | grep "[0-9]\+" | xargs -n1 kill
+        lsof bitbake.lock | awk '{print $2}' | grep "[0-9]\+" | xargs -n1 -r kill
     ;;
 esac