Update your dedicated steam game server on linux - automatically.
- Download
- Modify
- Verify
- Schedule
- Done
You will be done in ~15 minutes or less.
- A steam account
- A steam game server installed on Linux
-
SSH into your server and go to your game directory
cd <YOUR GAME SERVER DIRECTORY>
-
Fetch a copy of the bash file
curl https://raw.githubusercontent.com/gitsoft/SteamCMD-Linux-Game-Server-Updater/main/checkandupdate.sh --output checkandupdate.sh
-
Make the bash file executable
chmod +x checkandupdate.sh
-
Open the bashfile with a text editor
Replace <STEAM APPID GOES HERE> with a steam appid. No quotes, just the number.
appid=<STEAM APPID GOES HERE>
example for a Project Zomboid Server
appid=380870
You find the steam app id googling your game and visiting the games steam website. The appid is visible in the url.
-
Go to the bottom of the bashfile.
Replace the template text with real commands to updating and restaring your server.
if [ $updateserver == true ]; then echo "Run server update command" <INSERT SERVER UPDATE COMMAND> <INSERT SERVER RESTART COMMAND> fi
below is an example where a project Zomboid server is updated:
- the game install folder /home/pzuser/pz
- the server start script came with the installation is named start-server.sh
if [ $updateserver == true ]; then echo "Run server update command" ./steamcmd.sh +@sSteamCmdForcePlatformType linux +login anonymous +force_install_dir /home/pzuser/pz +app_update 380870 validate +quit ./start-server.sh fi
./checkupanddate.shExpected output the first time - (The version will be different for you. That's ok.)
previous version detected: 0
new version detected: 7913379Expected output after the first time
previous version detected: 7913379
new version detected: 7913379The bashfile is intended to run from time to time. Please use a reasonable interval of 60 minutes or more. Perhaps just once per day. Every time the script runs a request is sent to api.steamcmd.net. We do not wont to overload this api. That service is provided for free and we should be mindful to put too much pressure on it.
To schedule the script I would use crontab, or a screen/tmux session using watch. Whichever you find best.
open crontab
sudo crontab -eAdd a line for your cron job. Have a look at crontab-generator.org for examples and syntax help.
Below is an example where the script is executed 0400 each night.
* 4 * * * /home/zomboiduser/pz/checkandupdate.sh >/dev/null 2>&1
If you don't know what screen and tmux is then I suggest you use the crontab method above.
With tmux installed and logged in with your dedicated game user account, start a new session.
tmux new -s project-zomboid-sessionIn your tmux (or screen) session
watch -n 86400 /home/zomboiduser/pz/checkandupdate.sh >/dev/null 2>&1(86400 second per day)
Here is an overview that might help you.
You don't. 🙂 I lack both time and will to debate with strangers over issues, pull requests and additional ideas that would make this simple script into a bloated project with all sorts of dependencies. You are probably a nice person - but please fuck off. 🕊️
It sucks to be you. 🤷♂️ This script does not come with technical or emotional support. 💔
Why not use python/go/js/rust/fsharp/COBOL/Chicken?
Because most people just want to solve a problem real quick and move on with their lives.
Bash and crontab comes preinstalled on Linux. Why not KISS? 😄
Distributed under the MIT License. See LICENSE.txt for more information.
TLDR; Do whatever you want.
- api.steamcmd.net - that provides an excellent steamcmd api for free
- Othneil Drew - from whom I proudly stole a README template 😉
Go over to steamcmd.net or jona.io and give Jona Koudijs some ❤️ - He have obviously put some work into sharing something great with everyone for free. No fee and no account registration required. Just what people might want and no BS.
Thank you Jona! 🙏
And unlike me Jona seems to enjoy intercating with people. So help him out if you can.