[Piuparts-commits] [SCM] piuparts git repository branch, piatti, updated. 0.49-105-gac1319a

Andreas Beckmann anbe at debian.org
Fri Mar 1 15:32:50 UTC 2013


The following commit has been merged in the piatti branch:
commit dd1d6738433c5eac6c6ac1b46fdcab3aaa03bdc0
Author: Andreas Beckmann <anbe at debian.org>
Date:   Sun Feb 10 01:55:27 2013 +0100

    detect_slave_problems: move statefile to slave-directory
    
    be independent from a master installation
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>

diff --git a/debian/changelog b/debian/changelog
index 84035be..2e978e6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -26,6 +26,7 @@ piuparts (0.50) UNRELEASED; urgency=low
   * detect_slave_problems:
     - Move to slave-bin and run from slave crontab.
     - Use idle-sleep setting from piuparts.conf.
+    - 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_slave_problems b/slave-bin/detect_slave_problems
index 503258b..77adbb8 100755
--- a/slave-bin/detect_slave_problems
+++ b/slave-bin/detect_slave_problems
@@ -59,25 +59,30 @@ if [ "$HOSTNAME" != "piatti" ] ; then
 fi
 
 
+get_config_value SLAVEROOT global slave-directory
 get_config_value MASTER global master-directory
 get_config_value IDLE_SLEEP global idle-sleep 1800
 
 
-SCREENLOG=$MASTER/../slave/screenlog.0
+SCREENLOG=$SLAVEROOT/screenlog.0
 MONITORDIR=$MASTER/monitor-slave
 LOCKFILE="$MONITORDIR/slave-problems"
+STATEFILE=$SLAVEROOT/slave-problems
 
 mkdir -p $MONITORDIR
 cd $MONITORDIR
 chown piupartsm:piuparts $MONITORDIR
 chmod 775 $MONITORDIR
 
+# clear the statefile daily and whine again
+test $(file_age $STATEFILE) -lt 86000 || rm -f $STATEFILE
+
 # Only complain if screenlog is older than $IDLE_SPEEP + 1 minute (the slave
 # likes to sleep that long) and the problem is new or was not reported within
 # the previous 24 hours.
 if [ $(file_age $SCREENLOG) -le $(($IDLE_SLEEP + 60)) ]; then
-	rm -f $LOCKFILE
-elif [ ! -f $LOCKFILE ]; then
+	rm -f $STATEFILE
+elif [ ! -f $STATEFILE ]; then
 	{
 		echo "Either a test is running for a very long time (but no test"
 		echo "should run longer than an hour), piuparts-slave hangs or is"
@@ -87,8 +92,7 @@ elif [ ! -f $LOCKFILE ]; then
 		echo
 		tail $SCREENLOG
 	} | mail -s "problem with piuparts-slave detected" piupartss
-	touch $LOCKFILE
-	chmod 660 $LOCKFILE
+	touch $STATEFILE
 fi
 
 #

-- 
piuparts git repository



More information about the Piuparts-commits mailing list