To automate LinuxGSM you can set scheduled tasks using cronjobs, to run any command at any given time.
Commonly used scheduled tasks are:
Automatically check for updates
Automatically check for server crash and restart if needed
Automatically keep LinuxGSM up to date
Automatically restart the server at a given time
Automatically update and restart the server
To access and edit your cronjobs use crontab.
Cronjob as a user or root
It is possible to set up cronjobs as any user including root. The recommended way is to set up cronjobs using the game servers user account. However, If you run several game server installations on your server you may want to centrally manage cronjobs then using root.
* * * * * [/path/to/script] [command] > /dev/null 2>&1
* * * * * su — username -c ‘[/path/to/script] [command]’ > /dev/null 2>&1
Cronjob Timing Examples
Every single minute
Every 30 minutes
Every two hours
Every two hours at 30 minutes past the hour
Every day at 5:10 PM
Every Wednesday at 1 AM
Every Five Days at 1 AM
If you are not used to setting up cronjobs you can use
as a great reference to get started.
LinuxGSM Cronjobs examples
Replace username and gameserver with your own details.
Here is an example of a user based cronjob for a daily restart at 5 am.
0 5 * * * /home/username/gameserver restart > /dev/null 2>&1
Here is an example of a root based cronjob for a daily restart at 5 am.
0 5 * * * su — username -c ‘/home/username/gameserver restart’ > /dev/null 2>&1
Every X Time cronjobs
Here is an example of a user based cronjob to monitor your server every 5 minutes.
*/5 * * * * /home/username/gameserver monitor > /dev/null 2>&1
Here is an example of a root based cronjob to monitor your server every 5 minutes.
*/5 * * * * su — username -c ‘/home/username/gameserver monitor’ > /dev/null 2>&1
Below is a recommended basic example and will do the following:
Monitor your server every 5 minutes.
Check for an update every 30 minutes, update and restart only if an update is detected.
Restart and check for an update every day at 4:30 AM
Update check and update LinuxGSM every Sunday at midnight.
*/5 * * * * /home/username/gameserver monitor > /dev/null 2>&1
*/30 * * * * /home/username/gameserver update > /dev/null 2>&1
30 4 * * * /home/username/gameserver force-update > /dev/null 2>&1
0 0 * * 0 /home/username/gameserver update-lgsm > /dev/null 2>&1
Running on Boot
systemd is the default init system for most modern distros.
You need to create a service file in
Description=LinuxGSM Teamspeak3 Server
RemainAfterExit=yes #Assume that the service is running after main process exits with code 0
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
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
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.
@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.
After a reboot, any game server that has a «started» status will be started on boot. Servers that were manually stopped will remain stopped.
@reboot su — username -c ‘/home/username/gameserver monitor’ > /dev/null 2>&1
To learn more, see and
Start a game server unconditionally, even if you manually stop a server.
@reboot su — username -c ‘/home/username/gameserver start’ > /dev/null 2>&1
To learn more, see
rc.local is another method to run scripts on boot. Any commands added to the rc.local file will run on boot.
su — username -c ‘/home/username/gameserver start’
Home servers are a great way to experiment with game servers, for LAN parties or can be used as a permanent option if you have the bandwidth. There are extra steps required on your home router to allow external access to your game server. This will normally involve opening ports on the router firewall and/or port forwarding. See
for basic instructions. See your router’s manual for specific instructions.
Specifying you IP for Home Server
If you want to specify the game server IP address using the
ip= you will need to set the IP address of the servers LAN interface (e.g 192.168.1.2), not your routers external IP. Setting this incorrectly will prevent the game server ports from binding and your server will not start.
Depending upon the configuration of your server you may need to be more aware of its IP address configuration and how it relates to your game server.
This guide is not designed to be an in-depth guide to networking, instead focusing on parts relevent to game servers.
Internet Server vs Local Server
Your game server can be hosted online using a server provider such as Linode or for on a
at your house for either local-only LAN parties or allow online players in though your router.
All computers will have some sort of network interface (ethernet, fibre optic, wi-fi) to connect to a network. On Linux you can see your servers interfaces by using the following command.
Typically you may see (depending on distro) a
localhost loopback interface and an
eth0 interface. The
eth0 (ethernet) is used for your standard copper network cable and is what you will likely see. It is possible to use multiple interfaces individually or for more a advanced setup can be bonded together work as one interface to increase bandwidth and resilience.
IP Address Allocation
Each network interface can be allocated an IP address either manually on the server or via DHCP. If you are using a provider an internet IP address is normally automatically allocated to your server. For a local network, your router DHCP server will allocate a local IP address. A local IP address can be reserved using DHCP or you can manually set an IP on the server.
Single Server IP Address
The simplest and most common server configuration will have one network interface and thus one IP address. When your game server starts it will simply listen and bind to this IP address.
Multiple Server IP Addresses
Some servers will have multiple interfaces available and allow for multiple IP addresses to be assigned to it. In this configuration a server can listen and bind itself all IP addresses or just one.
The 0.0.0.0 IP is a meta-address means non-specific or all addresses. When you setup a game server you may notice the IP address 0.0.0.0 in command line parameters and settings. It is the default IP for game servers just signifies that the game server can listen and use all available server IP addresses.
Unless a specific IP address is required the game server IP can be set to 0.0.0.0.
If your server is hosted online you will have been allocated a public internet IP address that will be accessible by everyone online. Depending upon your server you may only need to configure your server firewall to open ports your game server uses.
Using a home server or virtual machine on your desktop is a great way to get started with LinuxGSM. However, a local network may require a better understanding of networking, how local IP addressing works and technologies such as DHCP and NAT.
When a server is hosted on a local network it will be given a private IP address that is only accessible to other devices on your local network. This is fine if you want to get friends around host a game server for a good old fashioned LAN party. But if you want to allow online players access to your local game server you will need to configure your home router’s firewall and setup port forwarding using NAT.
How LinuxGSM handles IP addresses
By default, LinuxGSM will use the 0.0.0.0 meta-address allowing all IP addresses to be automaticly used. LinuxGSM gathers various IP address information to try and automaticly determine the correct IP address to query, and what to display in
details and notifications.
If a specific IP address is required you can set it using the
ip setting in the LinuxGSM or game server config files. The same also applies if you wish to change the IP address of server noficiations you can use the .
Ports are communication endpoints for an application. A port will either listen or transmit network traffic on specific ports.
There are port standards set by IANA for common protocols such as HTTP (port 80), SSH (port 22), SMTP (port 25) etc. Game servers tend to use standard ports depending upon the game engine. For example source engine games by default use port 27015 as the port it listens on.
Here are the most common ones:
When you want to run
When you have a strict firewall and you need to open the right ports in order to let people connect to your server (see
When you need to forward ports on a NAT to the desired local IP in order for your server to be reachable from outside the local network (likely from the internet)
Port listeningis what a service like a game server does in order to receive packets from incoming connections: by listening to a port, the program waiting for incoming packets on a given port.
Port opening happens on a firewall, it consists of allowing traffic to a port.
Port redirection is part of NAT and happens on a router or firewall. It consists of forwarding incoming traffic on a given port to a specific local IP.
Network Address Translation (NAT) is a method of remapping an IP address into another by modifying
Game Server Ports
Game Servers typicaliy have ports for the following functions.
Game port: The port that players connect to. Query port: Used by software to gather information from the server such as server name, map and number of players. Rcon port Web port: used for game server that have web admin panels
Depending upon which game server being used, you can set game server ports within your start parameters or game server config file.
LinuxGSM allows you to see the ports your game server is using with the
./gameserver details command.
Useful port diagnostic command:
netstat -atunp | grep srcds_linux
DESCRIPTION DIRECTION PORT PROTOCOL
> Game/RCON INBOUND 27027 tcp/udp
> SourceTV INBOUND 27052 udp
< Client OUTBOUND 27002 udp
Changing Default Ports
Default ports are set in either the or
LinuxGSMYou can use
./gameserver details to find out where to edit port settings
# Change ports by editing the parameters in:
To alter them you will need to edit the file using
Example: for source games, you need to alter the following:
Which ports can be used?
You can use any port as long as it is not already in use and it is up to you to set up port allocation. It is recommended that ports are close together and sequential i.e 27015, 27016, 27017 to save confusion. Some servers ports by default are not sequential, however, there is nothing stopping you from changing this. Example for source engine game servers; you could set the port 27015, source tv port 27016, client port 27018. The next game server instance could simply follow on from this.
If you’re running multiple game servers, make sure you’re using different ports on all of your game servers to avoid a port conflict.
Multiple IP addresses
Should a server have multiple dedicated IP addresses allocated, it is possible for game servers to have the same ports but bound to the different IP addresses. Admins will need to set the specific IP address in the LinuxGSM config or game config.
Port Allocation Scheme
Each type of server has a default set of ports. This is fine to use if only one server is being set up. However, if multiple servers are being used a port scheme needs to be considered. There is no requirement to stick to specific ports but it is recommended they are in a logical order.
Source Default Ports
You can allocate ports incrementally, one after the other. With each server following on from the last.
This scheme is the simplest option to avoid confusion when managing ports. Plus this is the most efficient scheme reducing unused ports.
Standard Port Increment
This method increments each type of port keeping the scheme closer to the default. It is not as efficient but keeps ports more «standard».
Then increment those port by 1 for every new server. 25 servers are using 75 ports. After making 25 servers, if you need more it is a good idea is to add +100 to this 27000 range.
Separate IP Addresses
You can get new IP addresses for your dedicated server, and assign each server a new IP. This scheme is quite inefficient.
Track your ports
If you are running several game servers it is a good idea to create a spreadsheet of the ports you have used. Allowing you to keep track of what you have already used.
Diagnosing server accessibility
Check port are bound
Ensure the game server ports are bound and listening before anything else, you need to know if your server is actually listening. Input :
./gameserver details and look for this kind of diagnose command:
Useful port diagnostic command:
netstat -atunp | grep srcds_linux
Running the command will bring up any ports that are listening. If not, the game server has not started or not correctly binding to its allocated ports.
Check that ports are not already in use by something else.
Check that you are trying to listen to an actual interface IP.
Check that ports are not already in use by another application.
check that the server does not crash upon start by checking console logs or try starting the server with
Check the Firewall
are a regular source of connectivity issues. When diagnosing connection issues temporarily disabling a firewall will help identify if it is the source of the problem.
Check Port Forwarding (Local Networks)
Ensure that the router correctly redirects incoming traffic to the correct ports and local IP displayed with
./gameserver details with the correct protocol (TCP and/or UDP).
opt in voluntary feature that allows you to provide selected information about your game server to be displayed on
by enabling the
How is the information used?
All data collected is used to provide an insight into which game servers, distro and servers are popular with game server admins. This will assist in prioritising LinuxGSM development and give me (Daniel Gibbs) a never before insight into the numbers of people using LinuxGSM. This is a massive personal motivator as it has previously been difficult to know how many people actually use LinuxGSM.
The collected data is publicly available to view in a dashboard on
What information is collected?
Below is a list of types of data collected
Game Server — Knowing the game server you are running gives insights in to which servers are popular and can help shape development priorities.
Distro — It is useful to know which distros LinuxGSM is being used on to help focus development.
LinuxGSM Version — The currently installed version of LinuxGSM.
Alert Types — Which alerts have been turned on.
Game Server Usage
Gathering game server usage helps set the minimum required hardware for each game server. This is particularly useful for resource intensive servers.
CPU Used — The CPU usage in MHz (rounded to the neared 100MHz) of the game server.
RAM Used — The memory usage in MB (rounded to the neared 100MB) of the game server.
Disk Used — This storage taken by the game server (serverfiles directory) of the game server.
Gathering information on the server hardware being used to host a Game Server. This provides useful stats on the sorts of hardware game server admins are deciding to use.
CPU — Gathers the CPU Manufacturer and Model.
Disk Space — Total server disk space.
Country of origin
The country of origin is show identifying where in the world LinuxGSM is being used.
How is Information collected?
LinuxGSM Stats uses Google Analytics to collect information to allow Daniel Gibbs to get an idea of which game servers and distros are popular identify system requirements for game servers and know the sort of servers game server admins are using.
Is my data anonymous?
Short answer — Yes
Long answer — All information gathered is anonymous, the server IP address, hostname etc or other identifying information is not collected. When LinuxGSM Stats is first run it creates a
which is a randomly generated ID to allow Google Analytics to identify your unique information anonymously. Since this ID is random there is no way to know where the info is from, only that it is from the same sender.
The UUID is located in
lgsm/data/uuid.txt,if this file is deleted a new UUID will be generated.
How frequently is the data sent?
Data is sent every time the monitor runs as this is the only way to regularly send data.
How can I enable this feature?
To enable LinuxGSM Stats simply add the
stats="on" setting to the
common.cfg file. This can also be enabled on install.