LogoLogo
  • Home
  • Getting Started
  • Configuration
    • LinuxGSM Config
    • Game Server Config
    • Start Parameters
    • cronjobs
    • Running on Boot
    • Running Multiple Game Servers
    • IP Address Configuration
    • LinuxGSM Stats
  • Commands
    • install
    • start-stop-restart
    • monitor
    • test-alert
    • console
    • debug
    • update
    • check-update
    • force-update
    • validate
    • update-lgsm
    • backup
    • map-compressor
    • details
    • mods
    • skeleton
    • fastdl
    • change-password
  • Game Servers
    • 7 Days to Die
    • Arma 3
    • ARK: Survival Evolved
    • Call of Duty 4
    • Dont Starve Together
    • Counter-Strike 2
    • Counter-Strike: Global Offensive
    • Factorio
    • Garry's Mod
    • Insurgency: SandStorm
    • Killing Floor 2
    • Minecraft: Java Edition
    • Multi Theft Auto
    • Rust
    • Sven Co-op
    • Trackmania Nations Forever / Trackmania United Forever
    • TeamSpeak 3
    • Unreal Tournament 99
    • Unreal Tournament 2004
    • Unreal Tournament 3
    • Valheim
    • Xonotic
    • The Front [WIP]
  • Networking
    • IP Address
    • Ports
    • Source Engine
  • Alerts
    • Discord
    • Email
    • IFTTT
    • Pushbullet
    • Pushover
    • Rocket.Chat
    • Slack
    • Telegram
  • Dependencies
    • Java
    • tmux
    • jq
    • gamedig
    • glibc
  • Features
    • ANSI Colors
    • Stop Mode
    • Log Management
    • Message Display Time
  • SteamCMD
    • Steam Master Server
    • Game Server Login Token
    • Branch
    • LAN Discovery
    • Workshop
    • Error Codes
  • Linux
    • distro
    • ftp-scp
    • file-ownership
    • firewalls
    • network-interfaces
    • permissions
    • Symlinking and ln command
  • Troubleshooting
  • FAQ
  • Guides
    • Security
    • Make Webserver Case Insensitive
    • Sourcemod and Metamod:Source
  • Other
    • server-migration
    • basic-usage
    • brand
Powered by GitBook
On this page
  • Using systemd
  • Crontab
  • Using monitor command
  • Using start command
  • rc.local
Edit on GitHub
Export as PDF
  1. Configuration

Running on Boot

Using systemd

systemd is the default init system for most modern distros.

You need to create a service file in /etc/systemd/system/

Example ts3server.service

[Unit]
Description=LinuxGSM Teamspeak3 Server
After=network-online.target
Wants=network-online.target

[Service]
Type=forking
User=ts3server
WorkingDirectory=/home/ts3server
#Assume that the service is running after main process exits with code 0
RemainAfterExit=yes
ExecStart=/home/ts3server/ts3server start
ExecStop=/home/ts3server/ts3server stop
Restart=no

[Install]
WantedBy=multi-user.target

Replace the user and paths to fit your setup.

You need to reload the systemd-daemon once to make it aware of the new service file by systemctl daemon-reload

Now you can do

systemctl start ts3server # Start the server
systemctl stop ts3server  # Stop the server
systemctl enable ts3server # Enable start on boot
systemctl disable ts3server # Disable start on boot

Crontab

    @reboot '/home/username/gameserver monitor' > /dev/null 2>&1

Most admins will also have a timed monitor cronjob configured. If you do not want to have extra cronjobs the timed monitor will also start a server but with a timed delay.

Using monitor command

After a reboot, any game server that has a "started" status will be started on boot. Servers that were manually stopped will remain stopped.

crontab -e
@reboot su - username -c '/home/username/gameserver monitor' > /dev/null 2>&1

Using start command

Start a game server unconditionally, even if you manually stop a server.

crontab -e
@reboot su - username -c '/home/username/gameserver start' > /dev/null 2>&1

rc.local

rc.local is another method to run scripts on boot. Any commands added to the rc.local file will run on boot.

nano /etc/rc.local
su - username -c '/home/username/gameserver start'
PreviouscronjobsNextRunning Multiple Game Servers

Last updated 2 years ago

The crontab will allow you to create that allow you to run a command on a set time or on boot. The below example uses @reboot that will run a command on boot.

To learn more, see and .

To learn more, see

cronjobs
Start-Stop-Restart
cronjobs
automated monitoring