Run the Go Validator as a Linux Service

Set up the AutoBattle Go validator to run continuously as a systemd service — it will automatically start on boot, restart if it crashes, and run every 10 minutes to catch every validation window.

Requirements: A Linux system with systemd (Ubuntu 20.04+, Debian 11+, Fedora, etc.) and a regular user account. Root / sudo access is only needed for two commands.
1
Download the binary

Create a home directory for the validator and download the pre-built amd64 binary.

mkdir -p ~/autobattle
cd ~/autobattle
curl -sL https://autobattle.online/shell/validate_linux_amd64 -o validate
chmod +x validate

Verify it works before proceeding:

./validate --help
2
Store your API key

Save your key in a plain file so the service can read it without it appearing in process listings. Get your key from your profile page.

echo "YOUR_API_KEY" > ~/autobattle/api_key
chmod 600 ~/autobattle/api_key
3
Create a wrapper script

The service will call this script every 10 minutes. It reads the key file and runs the validator.

cat > ~/autobattle/run.sh <<'EOF'
#!/usr/bin/env bash
set -euo pipefail
KEY=$(cat ~/autobattle/api_key)
exec ~/autobattle/validate --key "$KEY"
EOF
chmod +x ~/autobattle/run.sh
4
Create the systemd timer unit

Two unit files are needed: a service (what to run) and a timer (when to run it). Copy and paste both blocks below. Replace YOUR_USERNAME with your actual Linux username (whoami).

Service file/etc/systemd/system/autobattle-validator.service

[Unit]
Description=AutoBattle cohort validator
After=network-online.target
Wants=network-online.target

[Service]
Type=oneshot
User=YOUR_USERNAME
ExecStart=/home/YOUR_USERNAME/autobattle/run.sh
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target

Timer file/etc/systemd/system/autobattle-validator.timer

[Unit]
Description=Run AutoBattle validator every 10 minutes
Requires=autobattle-validator.service

[Timer]
OnBootSec=2min
OnUnitActiveSec=10min
AccuracySec=30s

[Install]
WantedBy=timers.target

Write the files (requires sudo):

sudo nano /etc/systemd/system/autobattle-validator.service
sudo nano /etc/systemd/system/autobattle-validator.timer
5
Enable and start the timer
sudo systemctl daemon-reload
sudo systemctl enable --now autobattle-validator.timer

The validator will run once 2 minutes after boot, then every 10 minutes automatically.

6
Check that it's working

Run it manually right now to verify:

sudo systemctl start autobattle-validator.service

View the output:

journalctl -u autobattle-validator.service -n 50 --no-pager

Check the timer schedule:

systemctl list-timers autobattle-validator.timer
7
Updates are automatic

The validator checks for a newer version on every run. If an update is available it downloads the new binary, replaces itself, and continues — no action needed on your part.

You can confirm the running version at any time:

~/autobattle/validate --version

Useful commands

VPS / cloud note: If you're running this on a DigitalOcean Droplet or similar, make sure the binary is executable after any snapshot restore — file permissions can be stripped. Re-run chmod +x ~/autobattle/validate if the service fails to start.