server/synchro.sh

33 lines
661 B
Bash
Raw Normal View History

2014-11-20 20:03:35 +00:00
#!/bin/bash
2013-12-13 17:45:25 +00:00
# This script synchronizes first, the generated frontend and then
# retrieves submissions
2013-12-13 17:45:25 +00:00
cd `dirname "$0"`
2015-01-13 07:13:49 +00:00
. ./config.sh
2013-12-13 17:45:25 +00:00
if [ "$UID" = "0" ]
then
SCRIPT=`pwd`/`basename "$0"`
su -c "sh $SCRIPT $@" "$SYNCHRO_USER"
2013-12-13 17:45:25 +00:00
exit $?
fi
2013-12-14 05:11:14 +00:00
OPTS=
if [ "$1" = "delete" ]
then
OPTS="$OPTS --delete"
fi
# Synchronize HTML pages
rsync -e ssh -av $OPTS out "$FRONTEND_HOSTNAME":~/
rsync -e ssh -avL $OPTS files "$FRONTEND_HOSTNAME":~/
2015-01-13 16:58:33 +00:00
rsync -e ssh -av $OPTS front/ shared/ "$FRONTEND_HOSTNAME":~/
2013-12-13 17:45:25 +00:00
# Synchronize submissions
rsync -e ssh -av "$FRONTEND_HOSTNAME":~/submission/ submission/
ssh "$FRONTEND_HOSTNAME" "rm -fv ~/submission/*"
2013-12-13 17:45:25 +00:00
exit $?