Working synchronization

This commit is contained in:
nemunaire 2014-01-19 17:49:07 +01:00
commit 3c04523ca8
6 changed files with 135 additions and 44 deletions

View file

@ -1,6 +1,6 @@
#!/bin/sh
rm /tmp/stop
rm -f /tmp/stop
cd `dirname "$0"`
if [ "$UID" = "0" ]
@ -13,42 +13,21 @@ fi
touch ./logs/checks.log
tail -f ./logs/checks.log &
FULLREGEN=0
TMPF=`mktemp`
tail -f "$TMPF" | ./gen_site.pl -d -o ./out/ &
while ! [ -f /tmp/stop ];
do
if [ "$FULLREGEN" != "0" ]
then
./synchro.sh
else
./synchro.sh delete
fi
./synchro.sh delete > /dev/null
if [ `ls submission | wc -l` -gt 1 ]
then
TMPF=`mktemp`
if ! ./check.pl 2>> ./logs/checks.log > "$TMPF"
then
FULLREGEN=1
fi
if [ `cat "$TMPF" | wc -l` -gt 0 ]
then
while ! cat "$TMPF" | xargs ./gen_site.sh
do
echo "FAIL regeneration, retry..." 1>&2
done
fi
rm "$TMPF"
elif [ "$FULLREGEN" != "0" ]
then
while ! ./gen_site.sh; do
echo "FAIL regeneration, retry..." 1>&2
done
FULLREGEN=0
./check.pl 2>> ./logs/checks.log >> "$TMPF"
else
sleep 1
fi
done
rm -rf "$TMPF"