2014-11-20 20:03:35 +00:00
|
|
|
#!/bin/bash
|
2013-12-14 05:11:14 +00:00
|
|
|
|
2014-11-19 17:29:46 +00:00
|
|
|
# This script does all actions in backend production environment
|
|
|
|
|
2014-01-19 16:49:07 +00:00
|
|
|
rm -f /tmp/stop
|
2013-12-14 05:11:14 +00:00
|
|
|
cd `dirname "$0"`
|
|
|
|
|
2014-11-19 17:29:46 +00:00
|
|
|
source config.sh
|
|
|
|
|
2013-12-14 05:11:14 +00:00
|
|
|
if [ "$UID" = "0" ]
|
|
|
|
then
|
|
|
|
SCRIPT=`pwd`/`basename "$0"`
|
2014-11-19 17:29:46 +00:00
|
|
|
su -c "sh $SCRIPT" "$SYNCHRO_USER"
|
2013-12-14 05:11:14 +00:00
|
|
|
exit $?
|
|
|
|
fi
|
|
|
|
|
2014-11-20 20:03:35 +00:00
|
|
|
mkdir -p ./logs
|
|
|
|
|
2013-12-14 05:11:14 +00:00
|
|
|
touch ./logs/checks.log
|
|
|
|
tail -f ./logs/checks.log &
|
2014-01-21 02:08:08 +00:00
|
|
|
KP1=$!
|
2013-12-14 05:11:14 +00:00
|
|
|
|
2014-01-19 16:49:07 +00:00
|
|
|
TMPF=`mktemp`
|
|
|
|
|
2014-11-20 21:16:00 +00:00
|
|
|
tail -f "$TMPF" | ./gen_site.pl -d -s /tmp/test.sock -o ./out ERRORS HOME all DS &
|
2014-01-21 02:08:08 +00:00
|
|
|
KP2=$!
|
2013-12-14 05:11:14 +00:00
|
|
|
|
2014-01-14 15:14:31 +00:00
|
|
|
while ! [ -f /tmp/stop ];
|
2013-12-14 05:11:14 +00:00
|
|
|
do
|
2014-01-20 04:53:31 +00:00
|
|
|
./synchro.sh delete
|
2013-12-14 05:11:14 +00:00
|
|
|
|
|
|
|
if [ `ls submission | wc -l` -gt 1 ]
|
|
|
|
then
|
2014-01-21 02:08:08 +00:00
|
|
|
./clear_cache.sh top
|
2014-01-19 16:49:07 +00:00
|
|
|
./check.pl 2>> ./logs/checks.log >> "$TMPF"
|
2013-12-14 05:11:14 +00:00
|
|
|
|
|
|
|
else
|
|
|
|
sleep 1
|
|
|
|
fi
|
|
|
|
done
|
2014-01-19 16:49:07 +00:00
|
|
|
|
2014-01-21 02:08:08 +00:00
|
|
|
kill -9 $KP1 $KP2
|
|
|
|
|
2014-01-19 16:49:07 +00:00
|
|
|
rm -rf "$TMPF"
|