[Piuparts-commits] rev 719 - in piatti/home: piupartsm/bin piupartss/bin

Holger Levsen holger at alioth.debian.org
Wed Nov 10 17:36:02 UTC 2010


Author: holger
Date: 2010-11-10 17:36:01 +0000 (Wed, 10 Nov 2010)
New Revision: 719

Modified:
   piatti/home/piupartsm/bin/detect_slave_problems
   piatti/home/piupartss/bin/slave_run
Log:
mail screenlog when the slave crashes

Modified: piatti/home/piupartsm/bin/detect_slave_problems
===================================================================
--- piatti/home/piupartsm/bin/detect_slave_problems	2010-11-10 17:26:41 UTC (rev 718)
+++ piatti/home/piupartsm/bin/detect_slave_problems	2010-11-10 17:36:01 UTC (rev 719)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Copyright 2009 Holger Levsen (holger at layer-acht.org)
+# Copyright 2009-2010 Holger Levsen (holger at layer-acht.org)
 # 
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by the
@@ -48,7 +48,7 @@
 chown piupartsm.piuparts $MONITORDIR
 chmod 775 $MONITORDIR
 
-stamptime=$(/usr/bin/stat -c %Z $SCREENLOG)
+stamptime=$(/usr/bin/stat -c %Z $SCREENLOG 2>/dev/null || echo 0)
 unixtime=$(date +%s)
 difference=$(( $unixtime - $stamptime ))
 

Modified: piatti/home/piupartss/bin/slave_run
===================================================================
--- piatti/home/piupartss/bin/slave_run	2010-11-10 17:26:41 UTC (rev 718)
+++ piatti/home/piupartss/bin/slave_run	2010-11-10 17:36:01 UTC (rev 719)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Copyright 2009 Holger Levsen (holger at layer-acht.org)
+# Copyright 2009-2010 Holger Levsen (holger at layer-acht.org)
 # 
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by the
@@ -29,6 +29,8 @@
 rm -f $SCREENLOG					# used by ~piupartsm/bin/detect_slave_problems
 rm -f $MONITORDIR/*					# used by several scripts to only warn once a day 
 
+trap "cat $SCREENLOG | mail -s "slave abnormaly ended" piupartsm ; rm $SCREENLOG; exit" TERM EXIT
 screen -L -d -m -S piuparts-slave-screen su - piupartss -c "cd /org/piuparts.debian.org/slave && python ../share/piuparts/piuparts-slave"
+trap - TERM EXIT
 
 echo "piuparts-slave has been started."




More information about the Piuparts-commits mailing list