[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.49-33-gcdb8f37

Andreas Beckmann debian at abeckmann.de
Mon Jan 21 17:41:39 UTC 2013


The following commit has been merged in the develop branch:
commit f2c7f1e979d7c1bf3540406ce0a4a572ebf4264a
Author: Andreas Beckmann <debian at abeckmann.de>
Date:   Mon Jan 21 03:08:57 2013 +0100

    slave_{run,join,cleanup}: use pgrep to find processes
    
    Signed-off-by: Andreas Beckmann <debian at abeckmann.de>

diff --git a/debian/changelog b/debian/changelog
index 0ac8f51..c5795b8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -19,6 +19,7 @@ piuparts (0.50) UNRELEASED; urgency=low
   * pre_remove_50_find_missing_copyright: Add some exceptions.
   * Add several exceptions for lenny and lenny2squeeze tests.
   * slave_{run,join}: Rename the screen session to "piuparts_slave_screen".
+  * slave_{run,join,cleanup}: Use pgrep to find running processes.
 
  -- Andreas Beckmann <debian at abeckmann.de>  Tue, 15 Jan 2013 11:51:43 +0100
 
diff --git a/slave-bin/slave_cleanup b/slave-bin/slave_cleanup
index 5a80b92..570312b 100755
--- a/slave-bin/slave_cleanup
+++ b/slave-bin/slave_cleanup
@@ -23,11 +23,6 @@ set -e
 # - this should only be run (automatically) on boot
 #
 
-# do nothing if piuparts-slave is running
-if [ "$(ps fax|grep share/piuparts/piuparts-slave|grep -v grep)" != "" ] ; then
-	exit 0
-fi
-
 
 PIUPARTS_CONF=${PIUPARTS_CONF:-/etc/piuparts/piuparts.conf}
 [ -f "$PIUPARTS_CONF" ] || exit 0
@@ -51,6 +46,11 @@ get_config_value()
 get_config_value PIUPARTS_TMPDIR global tmpdir /org/piuparts.debian.org/tmp
 
 
+# do nothing if piuparts-slave is running
+if pgrep -f share/piuparts/piuparts-slave >/dev/null ; then
+	exit 0
+fi
+
 # umount all mount points (should be none on boot, but this script can also be called at other times)
 for MOUNTPOINT in $(tac /proc/mounts | cut -d " " -f 2 | grep "$PIUPARTS_TMPDIR/")
 do
diff --git a/slave-bin/slave_join b/slave-bin/slave_join
index 8eb5916..28d0d5a 100755
--- a/slave-bin/slave_join
+++ b/slave-bin/slave_join
@@ -23,7 +23,7 @@ set -e
 
 SESSIONNAME=piuparts_slave_screen
 
-if [ $(ps fax|grep piuparts-slave|grep -v grep |wc -l) != 0 ] ; then
+if pgrep -f "SCREEN.*$SESSIONNAME" >/dev/null ; then
   screen -R -S $SESSIONNAME
 else
   echo "piuparts-slave not running!"
diff --git a/slave-bin/slave_run b/slave-bin/slave_run
index fb7e649..c5c083a 100755
--- a/slave-bin/slave_run
+++ b/slave-bin/slave_run
@@ -26,8 +26,12 @@ SCREENLOG=/org/piuparts.debian.org/slave/screenlog.0
 MONITORDIR=/org/piuparts.debian.org/master/monitor-slave
 export PYTHONPATH=/org/piuparts.debian.org/lib/python2.6/dist-packages:/org/piuparts.debian.org/lib/python2.7/dist-packages
 
+if pgrep -f share/piuparts/piuparts-slave ; then
+	# slave is running
+	exit 0
+fi
+
 cd /org/piuparts.debian.org/slave
-(ps fax|grep -v grep| grep piuparts-slave ) && exit 0
 rm -f $SCREENLOG					# used by ~piupartsm/bin/detect_slave_problems
 rm -f $MONITORDIR/*					# used by several scripts to only warn once a day
 

-- 
piuparts git repository



More information about the Piuparts-commits mailing list