-
Notifications
You must be signed in to change notification settings - Fork 3
/
start_factorio.sh
executable file
·32 lines (26 loc) · 1.14 KB
/
start_factorio.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash
# Check for updates and install if necessary
./update_check.sh bootrun
# Setup Factorio startup arguments
FACTORIO_STARTUP_COMMANDS="--port ${FACTORIO_PORT}"
if [ ! -z ${FACTORIO_SERVER_SETTINGS+x} ]; then
if [ "$FACTORIO_SERVER_SETTINGS" != "" ]; then
FACTORIO_STARTUP_COMMANDS="$FACTORIO_STARTUP_COMMANDS --server-settings $FACTORIO_SERVER_SETTINGS"
fi
fi
## TODO: Since we can't check for updates properly right now, this would just cause issues for us..
# Start cron
echo "Starting scheduled task manager.."
node /scheduler_app/app.js &
# Set the working directory
cd /
## TODO: Disabled, because I think this has been implemented as part of the game itself now?
# Check for autosave file
#echo "Checking autosaves.."
#./check_autosave.sh
# Run the server (create map if it doesn't exist yet)
echo "Starting Factorio.."
if ! find -L /factorio/saves/ -iname \*.zip -mindepth 1 -print | grep -q .; then
/factorio/bin/x64/factorio --create "/factorio/saves/$FACTORIO_WORLD_NAME.zip" $FACTORIO_STARTUP_COMMANDS || true
fi
exec -a /factorio/bin/x64/factorio /factorio/bin/x64/factorio --start-server-load-latest $FACTORIO_STARTUP_COMMANDS