clean up cron jobs, add crontab, add flag to disable jobs

This commit is contained in:
Enno Rehling 2015-02-07 19:04:50 +01:00
parent 84da00f62d
commit 741cb30e90
8 changed files with 43 additions and 5 deletions

17
process/cron/crontab Normal file
View File

@ -0,0 +1,17 @@
# Crontab for Eressea on gruenbaer.kn-bremen.de
PATH=$HOME/bin:/opt/bin:/usr/local/bin:/usr/bin:/bin
ERESSEA=/home/eressea/eressea
ATLANTIS=/home/eressea/atlantis
ENABLED=no
CONFIRM=yes
# m h dom mon dow command
00 00 * * * $HOME/bin/fetchmail.cron
00 22 * * * $HOME/bin/backup-db.sh
*/2 * * * * [ "$CONFIRM" = "yes" ] || $ERESSEA/eressea/server/bin/orders.cron 2 3 4
15 21 * * Sat [ "$ENABLED" = "yes" ] || $ERESSEA/server/bin/run-eressea.cron 3
25 21 * * Sat [ "$ENABLED" = "yes" ] || $ERESSEA/server/bin/run-eressea.cron 4
35 21 * * Sat [ "$ENABLED" = "yes" ] || $ERESSEA/server/bin/run-eressea.cron 2
39 08 * * Sun [ "$ENABLED" = "yes" ] || $ERESSEA/server/bin/previews.cron

16
process/cron/orders.cron Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
## this script processes incoming order files.
# files are delivered into an incoming queue by procmail, then cron runs
# this here script to make a non-blocking syntax check and reject or
# accept the order file.
for GAME in $*
do
if [ "$GAME" == "eressea" ]; then GAME=2 ; fi
if [ "$GAME" == "e3a" ]; then GAME=3 ; fi
if [ -e $HOME/eressea/game-$GAME/orders.queue ]
then
$HOME/bin/orders-process $GAME
fi
done

View File

@ -5,10 +5,10 @@ branch="master"
if [ -e ${ERESSEA}/build/.preview ]; then if [ -e ${ERESSEA}/build/.preview ]; then
branch=`cat ${ERESSEA}/build/.preview` branch=`cat ${ERESSEA}/build/.preview`
fi fi
SRC=${ERESSEA}/git BIN=${ERESSEA}/server/s
${SRC}/s/preview build ${branch} || exit $? ${BIN}/preview build ${branch} || exit $?
${SRC}/s/preview version ${BIN}/preview version
for game in 2 3 4 ; do for game in 2 3 4 ; do
${SRC}/s/preview -g ${game} run && \ ${BIN}/preview -g ${game} run && \
${SRC}/s/preview -g ${game} send ${BIN}/preview -g ${game} send
done done

View File

@ -8,6 +8,8 @@ while [ ! -d $ROOT/.git ]; do
fi fi
done done
DEST=$(dirname $ROOT)/server
MACHINE=`uname -m` MACHINE=`uname -m`
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc" [ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc" [ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
@ -17,3 +19,6 @@ BIN_DIR="build-$MACHINE-$CC-Debug"
cd $ROOT/$BIN_DIR cd $ROOT/$BIN_DIR
make install make install
[ -d $DEST/bin ] || mkdir -p $DEST/bin
install -v $ROOT/process/cron/*.cron $DEST/bin/
crontab $ROOT/process/cron/crontab