forked from github/server
lock files to prevent accidents.
preview will only run if the turn worked out. cannot accidentally run in the game directory.
This commit is contained in:
parent
1a1ffd06b0
commit
e5d53769df
|
@ -13,7 +13,12 @@ if [ -d $REPORTS ]; then
|
|||
fi
|
||||
mkdir $REPORTS
|
||||
$BIN/backup-eressea $GAME
|
||||
if [ -d test ]; then
|
||||
touch test/execute.lock
|
||||
fi
|
||||
rm -f execute.lock
|
||||
$BIN/run-turn $GAME
|
||||
touch execute.lock
|
||||
if [ ! -s $ERESSEA/game-$GAME/orders.$TURN ]; then
|
||||
echo "server did not create orders for turn $TURN in game $GAME"
|
||||
exit 2
|
||||
|
@ -31,3 +36,4 @@ $BIN/compress.sh $GAME $TURN
|
|||
$BIN/sendreports.sh $GAME
|
||||
$BIN/backup-eressea $GAME
|
||||
[ $GAME -lt 4 ] && $BIN/send-summary $GAME
|
||||
rm -f test/execute.lock
|
||||
|
|
|
@ -182,6 +182,16 @@ function run_turn(rules)
|
|||
return result
|
||||
end
|
||||
|
||||
function file_exists(name)
|
||||
local f=io.open(name,"r")
|
||||
if f~=nil then io.close(f) return true else return false end
|
||||
end
|
||||
|
||||
if file_exists('execute.lock') then
|
||||
eressea.log.error("Lockfile exists, aborting.")
|
||||
assert(false)
|
||||
end
|
||||
|
||||
local path = 'scripts'
|
||||
if config.install then
|
||||
path = config.install .. '/' .. path
|
||||
|
|
Loading…
Reference in New Issue