[Dehs-devel] r142 - trunk
atomo64-guest at alioth.debian.org
atomo64-guest at alioth.debian.org
Wed Jun 11 23:02:10 UTC 2008
Author: atomo64-guest
Date: 2008-06-11 23:02:09 +0000 (Wed, 11 Jun 2008)
New Revision: 142
Modified:
trunk/dehs.sh
Log:
Be more atomic when locking the dehs.sh script
Also svn export debcheckout.pl for future usage
Modified: trunk/dehs.sh
===================================================================
--- trunk/dehs.sh 2008-06-02 00:08:31 UTC (rev 141)
+++ trunk/dehs.sh 2008-06-11 23:02:09 UTC (rev 142)
@@ -2,9 +2,11 @@
set -e
-#PATH="/var/lib/gforge/chroot/home/users/evaso-guest/projects/dehs:$PATH"
+
export BASEDIR=/org/home/groups/dehs
export WORKDIR=$BASEDIR/dehs_prj/dehs
+
+PATH="$BASEDIR/bin:$PATH"
LOCK=$BASEDIR/run.lock
BNAME=$(basename "$0")
@@ -12,8 +14,8 @@
maxattempts=30
while true; do
- if [ -e $LOCK ]; then
- PID=$(cat $LOCK)
+ if ! ln -s $$ $LOCK &>/dev/null; then
+ PID=$(basename $(readlink -f $LOCK))
if [ ! -n "$PID" ] || ! ps -p "$PID" | grep "$BNAME" &>/dev/null; then
echo "Removing stale lock file"
rm $LOCK
@@ -25,15 +27,13 @@
# lock file is okay, dehs.sh running
# let's wait ten minutes and try again
sleep $((10 * 60)) || exit 1
- attempts=$(($attempts + 1))
+ ((attempts++))
fi
else
break
fi
done
-echo $$ > $LOCK
-
run_type="-update_all"
update_www=1
@@ -70,13 +70,15 @@
fi
cd /tmp/
-if svn export svn://svn/devscripts/trunk/scripts/uscan.pl 1>/dev/null; then
- sed -i "s/###VERSION###/DEHS-SVN/g" uscan.pl
- if ! diff $WORKDIR/uscan.pl ./uscan.pl; then
- echo "New uscan.pl available" >&2
- fi
- rm -f uscan.pl
-fi
+for script in uscan.pl debcheckout.pl; do
+ if svn export svn://svn/devscripts/trunk/scripts/$script 1>/dev/null; then
+ sed -i "s/###VERSION###/DEHS-SVN/g" $script
+ if ! diff $WORKDIR/$script ./$script; then
+ echo "New $script available" >&2
+ fi
+ rm -f $script
+ fi
+done
for rt in $run_type; do
$WORKDIR/dehs_pg.php $rt >$WORKDIR/logs/stdout.log
More information about the Dehs-devel
mailing list