[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 cdb8f37d254db454420ccfa6ecad36a84ff94188
Author: Andreas Beckmann <debian at abeckmann.de>
Date:   Sun Jan 20 20:50:25 2013 +0100

    detect_leftover_processes: do not use master-directory
    
    this is a *slave* script
    
    delete the statefile daily and whine again
    
    Signed-off-by: Andreas Beckmann <debian at abeckmann.de>

diff --git a/debian/changelog b/debian/changelog
index c5795b8..5186305 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -20,6 +20,7 @@ piuparts (0.50) UNRELEASED; urgency=low
   * 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.
+  * detect_leftover_processes: Move statefile to slave-directory.
 
  -- Andreas Beckmann <debian at abeckmann.de>  Tue, 15 Jan 2013 11:51:43 +0100
 
diff --git a/slave-bin/detect_leftover_processes b/slave-bin/detect_leftover_processes
index 9875987..bad945b 100755
--- a/slave-bin/detect_leftover_processes
+++ b/slave-bin/detect_leftover_processes
@@ -1,4 +1,5 @@
 #!/bin/sh
+set -e
 
 # Copyright 2009 Holger Levsen (holger at layer-acht.org)
 #
@@ -16,6 +17,10 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
+#
+# find processes running in deleted chroots
+#
+
 
 PIUPARTS_CONF=${PIUPARTS_CONF:-/etc/piuparts/piuparts.conf}
 [ -f "$PIUPARTS_CONF" ] || exit 0
@@ -36,30 +41,28 @@ get_config_value()
 	eval "$1"='"$value"'
 }
 
-get_config_value MASTER global master-directory
+get_config_value SLAVEROOT global slave-directory
 get_config_value PIUPARTS_TMPDIR global tmpdir /org/piuparts.debian.org/tmp
 
-#
-# find processes running in deleted chroots
-#
-# FIXME: is this script still needed?
-# FIXME: why does this need access to the $MASTER directory?
-MONITORDIR=$MASTER/monitor-slave
-LOCKFILE="$MONITORDIR/leftover_processes"
+STATEFILE=$SLAVEROOT/leftover_processes
+
+# clear the statefile daily and whine again
+stamptime=$(stat -c %Z $STATEFILE 2>/dev/null || echo 0)
+unixtime=$(date +%s)
+difference=$(( $unixtime - $stamptime ))
+test $difference -lt 86000 || rm -f $STATEFILE
 
-OUTPUT=$(sudo ls  --color=never -lad /proc/*/root 2>/dev/null|grep "$PIUPARTS_TMPDIR" | grep "(deleted)")
-if [ "$OUTPUT" != "" ] && [ "$(cat $LOCKFILE)" != "$OUTPUT" ] ; then
+OUTPUT="$(sudo ls --color=never -lad /proc/*/root 2>/dev/null | grep "$PIUPARTS_TMPDIR" | grep "(deleted)")"
+if [ -z "$OUTPUT" ]; then
+	rm -f $STATEFILE
+elif [ "$(cat $STATEFILE 2>/dev/null)" != "$OUTPUT" ]; then
 	echo "Found processes running with a deleted chroot in $PIUPARTS_TMPDIR"
 	echo "This is usually because of 'FAIL: Processes are running inside chroot' which usually"
-	echo "means the packages violates 'must use invoke-rc.d (policy 9.3.3.2)'."
+	echo "means the package violates 'must use invoke-rc.d (policy 9.3.3.2)'."
 	echo
-	echo $OUTPUT
+	echo "$OUTPUT"
 	echo
 	echo "Please cleanup manually."
 	echo "#522918 has been filed to make this manual operation unneeded."
-	mkdir -p $MONITORDIR
-	sudo chown piupartsm:piuparts $MONITORDIR
-	sudo chmod 775 $MONITORDIR
-	echo $OUTPUT > $LOCKFILE
-	chmod 664 $LOCKFILE
+	echo "$OUTPUT" > $STATEFILE
 fi

-- 
piuparts git repository



More information about the Piuparts-commits mailing list