factorio-docker/smart_launch.sh
2016-10-25 16:49:23 +00:00

16 lines
311 B
Bash
Executable File

#!/bin/bash -x
SAVES=/opt/factorio/saves
if [ -f $SAVES/*.zip ]
then
last_save=$(ls $SAVES -lt | grep save |head -1 |awk '{print $(NF)}')
else
last_save="save.zip"
/opt/factorio/bin/x64/factorio --create $SAVES/$last_save
fi
exec /opt/factorio/bin/x64/factorio \
--start-server \
$SAVES/$last_save