factorio-docker/smart_launch.sh

16 lines
311 B
Bash
Raw Normal View History

2016-10-25 18:49:23 +02:00
#!/bin/bash -x
2016-10-25 18:49:23 +02:00
SAVES=/opt/factorio/saves
if [ -f $SAVES/*.zip ]
then
2016-10-25 18:49:23 +02:00
last_save=$(ls $SAVES -lt | grep save |head -1 |awk '{print $(NF)}')
else
2016-03-26 10:49:27 +01:00
last_save="save.zip"
2016-10-25 18:49:23 +02:00
/opt/factorio/bin/x64/factorio --create $SAVES/$last_save
fi
2016-03-26 10:49:27 +01:00
exec /opt/factorio/bin/x64/factorio \
2016-03-26 18:04:55 +01:00
--start-server \
2016-10-25 18:49:23 +02:00
$SAVES/$last_save