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.targetReplace 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
Crontab
The crontab will allow you to create cronjobs 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.
Using monitor command
monitor commandAfter a reboot, any game server that has a "started" status will be started on boot. Servers that were manually stopped will remain stopped.
To learn more, see cronjobs and automated monitoring.
Using start command
start commandStart a game server unconditionally, even if you manually stop a server.
To learn more, see Start-Stop-Restart
rc.local
rc.localrc.local is another method to run scripts on boot. Any commands added to the rc.local file will run on boot.
Last updated
Was this helpful?

