[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.50-200-gfc66298
Holger Levsen
holger at layer-acht.org
Tue May 14 11:55:42 UTC 2013
The following commit has been merged in the develop branch:
commit fc6629837aabeeee3aff86942d05a223adec3d27
Author: Holger Levsen <holger at layer-acht.org>
Date: Tue May 14 13:55:14 2013 +0200
Update slave-run to use get_config_value
diff --git a/slave-bin/slave_join b/slave-bin/slave_join
index b127e66..7b6da62 100755
--- a/slave-bin/slave_join
+++ b/slave-bin/slave_join
@@ -1,7 +1,7 @@
#!/bin/sh
set -e
-# Copyright 2009-2010 Holger Levsen (holger at layer-acht.org)
+# Copyright 2009-2013 Holger Levsen (holger at layer-acht.org)
# Copyright © 2013 Andreas Beckmann (anbe at debian.org)
#
# This program is free software; you can redistribute it and/or modify it
@@ -33,8 +33,6 @@ if ! `echo $SLAVENUM | grep -E -e "^[0-9]{1}$" >/dev/null` ; then
exit
fi
-SCREENLOG=/var/lib/piuparts/slave/screenlog.$SLAVENUM
-
if [ $(ps fax|grep piuparts-slave|grep slave/$SLAVENUM|grep -v grep |wc -l) != 0 ] ; then
screen -r -S piuparts-slave-screen -p $SLAVENUM -x
else
diff --git a/slave-bin/slave_run.in b/slave-bin/slave_run.in
index 17185e2..c517623 100755
--- a/slave-bin/slave_run.in
+++ b/slave-bin/slave_run.in
@@ -1,7 +1,7 @@
#!/bin/sh
set -e
-# Copyright 2009-2011 Holger Levsen (holger at layer-acht.org)
+# Copyright 2009-2013 Holger Levsen (holger at layer-acht.org)
# Copyright © 2013 Andreas Beckmann (anbe at debian.org)
#
# This program is free software; you can redistribute it and/or modify it
@@ -33,38 +33,43 @@ if ! `echo $SLAVENUM | grep -E -e "^[0-9]{1}$" >/dev/null` ; then
exit
fi
-SLAVEROOTDIR=/var/lib/piuparts/slave
-SLAVEDIR=$SLAVEROOTDIR/$SLAVENUM
+. @sharedir@/piuparts/lib/read_config.sh
-if [ ! -d $SLAVEDIR ] ; then
- install -d $SLAVEDIR
- chown piupartss:piuparts $SLAVEDIR
-fi
+get_config_value PYTHONPATH global PYTHONPATH ''
+get_config_value SLAVEROOT global slave-directory
+get_config_value PIUPARTS_TMPDIR global tmpdir
+
+export PYTHONPATH
+SLAVEDIR=$SLAVEROOT/$SLAVENUM
+SCREENLOG=$SLAVEROOT/screenlog.$SLAVENUM
+
+# cleanup cruft from previous runs
+ at sharedir@/piuparts/slave/slave_cleanup
-SCREENLOG=$SLAVEROOTDIR/screenlog.$SLAVENUM
-MONITORDIR=/var/lib/piuparts/master/monitor-slave
+# ensure the temporary directory exists
+mkdir -p $PIUPARTS_TMPDIR
-# prepare environment
-rm -f $SCREENLOG
+# ensure the slave directory exists
+mkdir -p $SLAVEDIR
-cd $SLAVEROOTDIR
+cd $SLAVEROOT
(ps fax|grep -v grep| grep piuparts-slave | grep $SLAVEDIR ) && 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
trap "cat $SCREENLOG | mail -s 'slave abnormaly ended' piupartsm ; rm $SCREENLOG; exit" TERM EXIT
# if screen session does not exist, create it
# remove screen logs to preserve slave_join logic
( ps ax | grep SCREEN | grep piuparts-slave-screen >/dev/null) ||\
- ( cd $SLAVEROOTDIR; screen -d -m -L -S piuparts-slave-screen; sleep 1; rm -f $SLAVEROOTDIR/screenlog.*)
+ ( cd $SLAVEROOT; screen -d -m -L -S piuparts-slave-screen; sleep 1; rm -f $SLAVEROOT/screenlog.*)
# make sure there is a window for this slave
screen -S piuparts-slave-screen -X screen -L $SLAVENUM
# launch the slave
+cd $SLAVEDIR
screen -S piuparts-slave-screen -p $SLAVENUM -X stuff "
-su - piupartss -c \"cd $SLAVEDIR; python /usr/share/piuparts/piuparts-slave\"
+ at sharedir@/piuparts/piuparts-slave
"
trap - TERM EXIT
--
piuparts git repository
More information about the Piuparts-commits
mailing list