Author Topic: How to start a Linux Paintball Server (Build 46 / Apr 13 2024)  (Read 34033 times)

mRokita

  • Autococker
  • Posts: 598
Re: How to start a Linux Paintball Server (Build 41 / Dec 25 2015)
« Reply #20 on: December 27, 2015, 07:43:04 AM »
Davew_, r.sh was a copy just to test some stuff.
Small tutorial:
As user root, create /root/runall.sh and do chmod +x /root/runall.sh and then edit it with vim or any other editor.
Example:
Code: [Select]
cd /home/paintball/paintball2/
sudo -u paintball2 screen -A -m -d -S myserver1 ./myserver1.sh

Then as root, do crontab -e, pick any editor you want to use and append @reboot /root/runall.sh to the end of the file and then save it

WarWulf

  • Autococker
  • Posts: 539
Re: How to start a Linux Paintball Server (Build 41 / Dec 25 2015)
« Reply #21 on: April 13, 2019, 06:40:42 PM »
so i keep doing the ./paintball2 +set dedicated........ etc and it says directory or file not found =/

3lf

  • Map Committee
  • VM-68
  • Posts: 121
Re: How to start a Linux Paintball Server (Build 41 / Dec 25 2015)
« Reply #22 on: May 31, 2020, 08:34:38 AM »
Posting this here for future purposes and in-case someone else needs this too. For debian 8+. This creates a systemd service, that should restart the server automatically after crashing/server reboots/etc. Make sure you have tmux installed and a server config named 'server_servername.cfg'. also you need to specify the port in server config.

to re-attach server console use 'tmux -L servername attach -t servername' and to detach Ctrl+B, D

You can start multiple servers too:

Code: [Select]
systemctl start paintball@public
systemctl start paintball@match


Code: [Select]
# cat /etc/systemd/system/paintball@.service

[Unit]
Description=Digitalpaint Paintball2 Server %i

Wants=network.target
After=network.target

[Service]
User=paintball
Type=forking
PrivateTmp=false
Restart=always
RestartSec=5s
Nice=-5
WorkingDirectory=/home/paintball/paintball2/
ExecStart=/usr/bin/tmux -L %i new-session -s %i -d '/home/paintball/paintball2/paintball2 +set dedicated 1 +exec server_%i.cfg +map arenaball'
ExecStop=/usr/bin/tmux -L %i send-keys -t %i 'say SERVER SHUTTING DOWN in 5s' C-m
ExecStop=/bin/sleep 5
ExecStop=/usr/bin/tmux -L %i send-keys -t %i 'say SERVER SHUTTING DOWNl' C-m
ExecStop=/bin/sleep 2
ExecStop=/usr/bin/tmux -L %i kill-server


[Install]
WantedBy=multi-user.target


#########
# HowTo
#########
#
# Enable/Start systemd service
#    systemctl daemon-reload
#    systemctl enable paintball@servername
#    systemctl start paintball@servername
#    systemctl stop paintball@servername
« Last Edit: July 30, 2020, 12:09:03 PM by 3lf »