Skip to content

gitsoft/SteamCMD-Linux-Game-Server-Updater

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation


SteamCMD Linux Game Server Updater

About The Project / Bash file

Update your dedicated steam game server on linux - automatically.

  1. Download
  2. Modify
  3. Verify
  4. Schedule
  5. Done

You will be done in ~15 minutes or less.

Getting Started

Prerequisites

  • A steam account
  • A steam game server installed on Linux

Installation

  1. SSH into your server and go to your game directory

    cd <YOUR GAME SERVER DIRECTORY>
  2. Fetch a copy of the bash file

    curl https://raw.githubusercontent.com/gitsoft/SteamCMD-Linux-Game-Server-Updater/main/checkandupdate.sh --output checkandupdate.sh
  3. Make the bash file executable

    chmod +x checkandupdate.sh
  4. 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.

  5. 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

(back to top)

Usage

Test the script

 ./checkupanddate.sh

Expected output the first time - (The version will be different for you. That's ok.)

previous version detected: 0
new version detected: 7913379

Expected output after the first time

previous version detected: 7913379
new version detected: 7913379

(back to top)

Schedule the script

The 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.

Scheduling example with crontab

open crontab

sudo crontab -e

Add 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

(back to top)

Scheduling example with tmux and a watch statement

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-session

In your tmux (or screen) session

watch -n 86400 /home/zomboiduser/pz/checkandupdate.sh >/dev/null 2>&1

(86400 second per day)

(back to top)

Wait, I dont understand how this works.

Here is an overview that might help you.

server-update-flow.svg

Contributing

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. 🕊️

(back to top)

It doesn't work on my computer

It sucks to be you. 🤷‍♂️ This script does not come with technical or emotional support. 💔

(back to top)

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? 😄

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

TLDR; Do whatever you want.

(back to top)

Acknowledgments ❤️

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.

About

Makes it possible to update your game server automatically when a new version is released

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages