Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/joshuaKnauber/serpens_addon_market/llms.txt

Use this file to discover all available pages before exploring further.

The repository includes two shell scripts to help you operate the bot: run.sh starts the bot as a background process and routes all output to a log file, while gitpush.sh lets you manually sync any direct changes to the JSON data files back to the remote repository. Together they provide a lightweight operational workflow for keeping the marketplace running and its data versioned.

Starting the Bot

1

Update the working directory path in run.sh

The run.sh script contains a hardcoded absolute path that must match your system. Open the file and replace /home/finn/serpens_addon_market/ with the actual path to your cloned repository:
run.sh
#!/bin/bash

cd /home/finn/serpens_addon_market/

touch output.log

nohup python serpens_bot.py >> output.log 2>> output.log &
The script creates output.log if it does not exist, then launches serpens_bot.py with nohup so the process continues running after your shell session ends. Both stdout and stderr are appended to output.log.
2

Make the script executable and run it

chmod +x run.sh
./run.sh
The bot process starts in the background immediately. Your terminal prompt returns as soon as the script completes.
3

Check the log for successful startup

tail -f output.log
A successful startup prints the following line to the log:
Connected to Discord!
If you see Python tracebacks instead, verify your DISCORD_TOKEN in .env, confirm the channel IDs have been updated, and ensure the three JSON data files exist.

Stopping the Bot

The bot runs as a background process under nohup. To stop it, find its process ID and send a termination signal:
ps aux | grep serpens_bot.py
Identify the PID in the second column of the matching line, then kill the process:
kill <PID>

Automatic Git Sync

Every time the bot finishes processing a Discord message — whether it was an upload, update, removal, or just an unrecognized command — it runs the following four commands via os.system:
serpens_bot.py
os.system("git add -A")
os.system("git commit -m\"Serverlog\"")
os.system("git pull")
os.system("git push")
This means every completed submission, update, or removal is immediately staged, committed with the message Serverlog, pulled from remote to incorporate any concurrent changes, and then pushed back to GitHub. The git pull before git push is intentional — it reduces the chance of a rejected push when the remote has diverged. The working directory must have git configured with push access at all times, and the bot must be run from inside the repository directory (which run.sh ensures via cd).
All four git commands are called with os.system, which does not raise a Python exception if a command fails. If your SSH keys or credential cache are not configured, the push will silently fail on every message — no error will appear in output.log unless git itself writes to stderr. Verify the sync is working by checking your remote repository’s commit history for Serverlog commits.

Manual Push with gitpush.sh

If you edit addons.json, snippets.json, or packages.json directly — for example to fix a broken entry or remove stale data — those changes will not be auto-pushed because the bot only triggers the sync on Discord message events. Use gitpush.sh to manually sync them:
gitpush.sh
git add -A
git commit -m "Serverlog"

git push
Run it from the repository root:
chmod +x gitpush.sh
./gitpush.sh
Unlike the bot’s automatic sync, gitpush.sh does not run git pull before pushing. If the remote has commits that your local branch does not have, the push will be rejected. In that case, run git pull manually before executing gitpush.sh.

Monitoring

All bot output — including the startup message, Discord events, and any Python errors — is captured in output.log by run.sh.
  • Watch live output:
    tail -f output.log
    
  • View the last 50 lines:
    tail -n 50 output.log
    
  • Truncate the log when it grows too large (the log is never rotated automatically):
    > output.log
    
run.sh has /home/finn/serpens_addon_market/ hardcoded as the working directory. If you do not update this path before running the script, the cd will fail, the log file will be created in the wrong location, and serpens_bot.py will not be found. Always edit run.sh to match the actual path on your system before the first run.
For more robust production deployments, consider managing the bot process with systemd or supervisor instead of plain nohup. These tools provide automatic restarts on crash, structured log rotation, and process supervision — all of which run.sh does not offer on its own.

Build docs developers (and LLMs) love