server.bin (the compiled trading bot, ~60MB)license.enc (license file)/home/ubuntu/.
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install -y ufw
sudo ufw allow 22/tcp # allow SSH
sudo ufw allow 8765/tcp # allow client-to-bot communication
sudo ufw --force enable
chmod +x /home/ubuntu/server.bin
sudo chown ubuntu:ubuntu /home/ubuntu/server.bin /home/ubuntu/license.enc
Create the service file:
sudo nano /etc/systemd/system/trading_bot.service
Paste this:
[Unit]
Description=Prime Trading Bot
After=network.target
[Service]
User=ubuntu
WorkingDirectory=/home/ubuntu
ExecStart=/home/ubuntu/server.bin
Restart=always
RestartSec=10
StandardOutput=append:/home/ubuntu/trading_bot.log
StandardError=append:/home/ubuntu/trading_bot.err
[Install]
WantedBy=multi-user.target
Save and exit (Ctrl+O, Enter, Ctrl+X).
sudo systemctl daemon-reload
sudo systemctl enable trading_bot.service
sudo systemctl start trading_bot.service
systemctl status trading_bot.service
You should see active (running) if it started successfully.
tail -f /home/ubuntu/trading_bot.log
# For errors:
tail -f /home/ubuntu/trading_bot.err
sudo systemctl start trading_bot.servicesudo systemctl stop trading_bot.servicesudo systemctl restart trading_bot.servicesudo systemctl status trading_bot.servicecurl ifconfig.me