In my free time, amongst other things, I like to play a round of Factorio. In a nutshell Factorio is a game centered around automating production.
I think this Video explains the concept of the game quite well.
https://www.youtube.com/watch?v=KVvXv1Z6EY8
This game can be played by multiple players on a server. There is a nice Docker Container for Factorio that allows you to have your own server up and running in no time.
Unfortunately there is no easy way to allow other players uploading maps to the server. So I came up with a solution using nextcloud.
What you need:
The Idea:
Add the following line to the /etc/crontab and use the path were you dropped that script.
* * * * * root /path/to/script.sh
The script:
Directories:
You will have to change the script by hand, and generate the ssh keys. It is not pretty but it does work.
Cheers, Ori
#!/bin/bash factorio=$(ssh root@IP ‘cat path/to/Checkme.txt’)
if (echo $factorio | grep -q “1”) then service docker stop cp /opt/factorio/saves/save.zip /opt/factorio/backup_save/save.zip rm -rf /opt/factorio/saves/* scp root@IP:/path/to/savegame/\*.zip /opt/factorio/saves/. chown -R 845:845 /opt/factorio/saves
service docker start
ssh root@192.168.122.79 ’echo “0” > path/to/Checkme.txt’ ssh root@192.168.122.79 ’echo “Server rebooted at $(date +\%d-\%m-\%Y-\%H-\%M-\%S)” » path/to/RebootLog.txt’ factorio=0 else echo “DEBUG ME SEMPAI” fi