Skip to main content

Running BozoBot 24/7 AFK

To maximize your trading opportunities, you'll likely want to run BozoBot continuously in the background. This guide provides detailed instructions for running BozoBot 24/7 on various operating systems.

Preparation

Before setting up continuous operation, ensure:

  1. Your bot is correctly configured in the .env file
  2. You've tested the bot manually to confirm it works as expected
  3. Your system has a stable internet connection
  4. You have sufficient SOL in your wallet for trading and transaction fees

Linux Setup

Linux is the recommended platform for running BozoBot 24/7 due to its stability and efficient resource usage.

Systemd is the modern service manager for most Linux distributions and provides the most reliable way to run BozoBot as a background service.

  1. Create a systemd service file:
sudo nano /etc/systemd/system/bozobot.service
  1. Add the following configuration (adjust paths as needed):
[Unit]
Description=BozoBot Trading Bot
After=network.target

[Service]
User=YOUR_USERNAME
WorkingDirectory=/path/to/bozobot
ExecStart=/path/to/bozobot/bozobot
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
  1. Save the file (Ctrl+O, Enter, Ctrl+X)

  2. Enable and start the service:

sudo systemctl enable bozobot
sudo systemctl start bozobot
  1. Check status and logs:
# Check service status
sudo systemctl status bozobot

# View logs in real-time
sudo journalctl -fu bozobot --output cat
  1. To stop the bot:
sudo systemctl stop bozobot

Using Screen

If you prefer not to use systemd, the screen utility is a good alternative:

  1. Install screen if not already installed:
sudo apt install screen  # For Ubuntu/Debian
sudo yum install screen # For CentOS/RHEL
  1. Start a new screen session:
screen -S bozobot
  1. Navigate to your BozoBot directory and start the bot:
cd /path/to/bozobot
./bozobot
  1. Detach from the screen session (the bot will continue running):

    • Press Ctrl+A then D
  2. To reattach to the screen session later:

screen -r bozobot

Using Nohup

For a simpler approach, you can use nohup:

cd /path/to/bozobot
nohup ./bozobot > bozobot.log 2>&1 &

This will run BozoBot in the background, writing output to bozobot.log. To stop the bot, find its process ID and kill it:

ps aux | grep bozobot
kill -9 PROCESS_ID

macOS Setup

Using LaunchAgents

  1. Create a LaunchAgent plist file:
nano ~/Library/LaunchAgents/com.user.bozobot.plist
  1. Add the following configuration (adjust paths as needed):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.user.bozobot</string>
<key>ProgramArguments</key>
<array>
<string>/path/to/bozobot/bozobot</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>WorkingDirectory</key>
<string>/path/to/bozobot</string>
<key>StandardOutPath</key>
<string>/path/to/bozobot/bozobot.log</string>
<key>StandardErrorPath</key>
<string>/path/to/bozobot/bozobot-error.log</string>
</dict>
</plist>
  1. Load the LaunchAgent:
launchctl load ~/Library/LaunchAgents/com.user.bozobot.plist
  1. To start/stop the bot:
# Start
launchctl start com.user.bozobot

# Stop
launchctl stop com.user.bozobot

# Unload (remove from auto-start)
launchctl unload ~/Library/LaunchAgents/com.user.bozobot.plist

Using Terminal with Screen

macOS also supports the screen utility, similar to Linux:

  1. Install screen via Homebrew if not already installed:
brew install screen
  1. Then follow the same screen instructions as in the Linux section.

Windows Setup

Using Task Scheduler

  1. Open Task Scheduler (search for it in the Start menu)

  2. Click "Create Basic Task" in the right panel

  3. Enter a name (e.g., "BozoBot") and description, then click "Next"

  4. Select "When the computer starts" and click "Next"

  5. Select "Start a program" and click "Next"

  6. Browse to select your BozoBot executable, and set "Start in" to your BozoBot directory

  7. Click "Next" and then "Finish"

  8. Right-click on your new task and select "Properties"

  9. Check "Run with highest privileges" and set "Configure for:" to your Windows version

  10. On the "Settings" tab, uncheck "Stop the task if it runs longer than:"

  11. Click "OK" to save changes

Using Windows Terminal

For shorter sessions or testing:

  1. Open Command Prompt or PowerShell

  2. Navigate to your BozoBot directory:

cd C:\path\to\bozobot
  1. Start the bot:
start /B bozobot.exe > bozobot.log 2>&1

Cloud Server Setup

For maximum uptime and reliability, consider running BozoBot on a cloud server:

VPS Recommendations

  • CPU: 1-2 cores
  • RAM: 2GB minimum
  • Disk: 20GB SSD
  • OS: Ubuntu 20.04/22.04 LTS

Popular VPS providers include DigitalOcean, Linode, AWS Lightsail, and Vultr.

Setup Process

  1. Create and configure your VPS

  2. Upload BozoBot to the server (using SCP or SFTP):

scp -r /path/to/local/bozobot username@server_ip:~/bozobot
  1. SSH into your server:
ssh username@server_ip
  1. Follow the Linux setup instructions above

Monitoring and Maintenance

Log Rotation

For long-running instances, set up log rotation to prevent log files from growing too large:

  1. Create a logrotate configuration:
sudo nano /etc/logrotate.d/bozobot
  1. Add the following configuration:
/path/to/bozobot/*.log {
daily
missingok
rotate 7
compress
delaycompress
notifempty
create 0640 YOUR_USERNAME YOUR_USERNAME
}

Remote Monitoring

Consider setting up remote monitoring in addition to Telegram PnL notifications:

  1. Set up a health check endpoint (if you have web server experience)
  2. Use a service like UptimeRobot to monitor connectivity
  3. Configure email alerts for server issues

Troubleshooting

Bot Crashes or Stops Running

If the bot stops unexpectedly:

  1. Check the logs for error messages
  2. Ensure your wallet has sufficient SOL
  3. Verify your RPC endpoints are accessible
  4. Make sure your system isn't running out of resources

System Reboots

After system reboots:

  1. For systemd (Linux): The bot should restart automatically
  2. For LaunchAgents (macOS): The bot should restart automatically
  3. For Task Scheduler (Windows): Verify the task is set to run at startup
  4. For manual methods (screen/nohup): You'll need to restart the bot manually

Security Considerations

Running a trading bot 24/7 involves significant security considerations:

  1. Private Key Security: Never run the bot on shared or untrusted systems
  2. System Updates: Regularly update your operating system and security packages
  3. Firewall Configuration: Limit inbound connections to your server
  4. User Permissions: Run the bot under a dedicated user with limited permissions
  5. Backup: Regularly backup your configuration files