[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.50-207-geca84e9
Andreas Beckmann
anbe at debian.org
Tue May 14 14:22:39 UTC 2013
The following commit has been merged in the develop branch:
commit e438178595ee6e2551d141e700cf2ac6145200e4
Author: Andreas Beckmann <anbe at debian.org>
Date: Tue May 14 14:25:56 2013 +0200
Revert "Merge remote-tracking branch 'dave/makeitwork' into develop"
This reverts commit 1df6c0a4ea24022f3e9a395c1a2458e3c51465da, reversing
changes made to 1af9b0dac02d1cbfef1d745336719c8b38a8f82f.
diff --git a/slave-bin/slave_join b/slave-bin/slave_join
index b127e66..8e3fb26 100755
--- a/slave-bin/slave_join
+++ b/slave-bin/slave_join
@@ -22,22 +22,9 @@ set -e
# reattach to an existing slave session
#
-if [ -z "$1" ] ; then
- SLAVENUM=0
-else
- SLAVENUM=$1
-fi
-
-if ! `echo $SLAVENUM | grep -E -e "^[0-9]{1}$" >/dev/null` ; then
- echo "slave must be identified as a number between 0 and 9"
- exit
-fi
-
-SCREENLOG=/var/lib/piuparts/slave/screenlog.$SLAVENUM
+SESSIONNAME=piuparts_slave_screen
-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
+if screen -ls $SESSIONNAME | grep -q "No Sockets found" ; then
echo "piuparts-slave not running!"
echo
echo "ps faxu | grep piuparts"
diff --git a/slave-bin/slave_run.in b/slave-bin/slave_run.in
index 17185e2..0fd78d0 100755
--- a/slave-bin/slave_run.in
+++ b/slave-bin/slave_run.in
@@ -22,51 +22,37 @@ set -e
# Run piuparts-slave in screen to allow interactive control later on.
#
-if [ -z "$1" ] ; then
- SLAVENUM=0
-else
- SLAVENUM=$1
-fi
-if ! `echo $SLAVENUM | grep -E -e "^[0-9]{1}$" >/dev/null` ; then
- echo "slave must be identified as a number between 0 and 9"
- exit
-fi
+. @sharedir@/piuparts/lib/read_config.sh
-SLAVEROOTDIR=/var/lib/piuparts/slave
-SLAVEDIR=$SLAVEROOTDIR/$SLAVENUM
+get_config_value PYTHONPATH global PYTHONPATH ''
+get_config_value SLAVEROOT global slave-directory
+get_config_value PIUPARTS_TMPDIR global tmpdir
-if [ ! -d $SLAVEDIR ] ; then
- install -d $SLAVEDIR
- chown piupartss:piuparts $SLAVEDIR
-fi
-SCREENLOG=$SLAVEROOTDIR/screenlog.$SLAVENUM
-MONITORDIR=/var/lib/piuparts/master/monitor-slave
+export PYTHONPATH
-# prepare environment
-rm -f $SCREENLOG
+SESSIONNAME=piuparts_slave_screen
+SCREENLOG=$SLAVEROOT/screenlog.0
-cd $SLAVEROOTDIR
-(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 -ls $SESSIONNAME | grep -q "No Sockets found" ; then
+ echo "piuparts-slave is already running!"
+ echo
+ screen -ls
+ exit 1
+fi
-# 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.*)
+# cleanup cruft from previous runs
+ at sharedir@/piuparts/slave/slave_cleanup
+rm -f $SCREENLOG
-# make sure there is a window for this slave
-screen -S piuparts-slave-screen -X screen -L $SLAVENUM
+# ensure the temporary directory exists
+mkdir -p $PIUPARTS_TMPDIR
-# launch the slave
-screen -S piuparts-slave-screen -p $SLAVENUM -X stuff "
-su - piupartss -c \"cd $SLAVEDIR; python /usr/share/piuparts/piuparts-slave\"
-"
+mkdir -p $SLAVEROOT
+cd $SLAVEROOT
-trap - TERM EXIT
+# finally, run piuparts-slave in screen
+screen -L -d -m -S $SESSIONNAME @sharedir@/piuparts/piuparts-slave
echo "piuparts-slave has been started."
--
piuparts git repository
More information about the Piuparts-commits
mailing list