Last active
August 22, 2019 18:57
-
-
Save siasur/5df4c4722b79bf5249c468caba256bb3 to your computer and use it in GitHub Desktop.
Factorio Server stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -f .factorio-lock ]; then | |
echo "Factorio Server is already running." | |
exit 1 | |
else | |
touch .factorio-lock | |
fi | |
screen -Dm -S factorio ./watchdog & echo $! > .factorio-lock | |
echo "Starting the server." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ ! -f .factorio-lock ]; then | |
echo "Factorio Server is not running." | |
exit 0 | |
fi | |
pid=$(cat .factorio-lock) | |
rm .factorio-lock | |
screen -S factorio -p 0 -X stuff "^C" | |
while (screen -ls | grep $pid > /dev/null); do : ; done; | |
echo "Factorio Server stopped." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
python update_factorio.py --apply-to factorio/bin/x64/factorio -x -D | |
chmod +x factorio/bin/x64/factorio | |
echo "Update finished." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while [ -f .factorio-lock ]; do | |
cd factorio | |
./bin/x64/factorio --start-server-load-latest --server-settings ./data/server-settings.json | |
cd .. | |
# Uncomment when using a telegram bot for crash notification | |
# if [ -f .factorio-lock ]; then | |
# curl --header "Content-Type: application/json" --request POST --data '{"chat_id":"<INSERT CHAT ID>","text":"<INSERT MESSAGE TEXT>"}' https://api.telegram.org/bot<INSERT BOT TOKEN>/sendMessage | |
# fi | |
done |
I just added the missing update.sh
file. This script just calls narc0tiqs factorio-updater and sets the perms on the factorio executable again after the finished update
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
These scripts expect to be one folder higher than the factorio server installation.
If the path to your binary is
/usr/servers/factorio/bin/x64/
then the script should be inservers
.If you have another structure you may want to change/remove the paths inside the
watchdog
.