Norman Dumond's WinBolo Projects


~~~Bash script to spawn back-to-back random maps~~~

Features:

- Spawns games with random maps from a directory
- Spawns a new random map after each game ends
- Allows Start/Stop/Status control over WinBolo server
- Can be used to start WinBolo server on system startup
- Creates a PID file

Copy the following into a .sh file and make it executable:

#!/bin/bash
screen -S WinBoloServer -dm bash -c 'while true; do $ServerPath -map "$(find $MapDir -type f | shuf -n1)" -port $PortNumber -autoclose -gametype strict -mines no -aitype no -limit -1 -tracker tracker.winbolo.com:50000; sleep 1; done'
ps faux | grep "SCREEN -S WinBoloServer" | grep -v grep | awk '{print $2}' > $PIDFile

Replace: $ServerPath with the path to the WinBolo server application like so: /home/someuser/winbolo/linbolods
Replace: $MapDir with the path to the directory containing map files like so: /home/someuser/winbolo/maps
Replace: $PIDFile with the path to the PID file which will be created on startup like so: /home/someuser/winbolo/pidfile.pid
Replace: $PortNumber with the port number you want to use to host the WinBolo server

~~~SystemD Script to start/stop this bash script~~~

[Unit]
Description=WinBolo Server
After=network.target

[Service]
User=$user
Type=forking
ExecStart=/path/to/bolo.sh
TimeoutStartSec=20
PIDFile=/path/to/bolopid.pid

[Install]
WantedBy=default.target

Replace: $user with the Linux user which will run the server application
Replace: /path/to/bolo.sh with the path to the above bash script like so: /home/someuser/winbolo/bolo.sh
Replace: /path/to/bolopid.pid with the path to the PID file which will be created on startup like so: /home/someuser/winbolo/pidfile.pid