# Redeploy a Live Trading Bot Safely (PM2, Go)

> A redeploy runbook for a live trading service under PM2: catch new required env vars before boot, confirm the account is flat, back up the binary, restart by the real process name, prove the new build is live, roll back fast.

Redeploy a Live Trading Bot Safely (PM2, Go) is a paid AI agent skill on Agensi by Claude Workflow Lab, in DevOps & Cloud. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $7 (one-time purchase)
- Creator: [Claude Workflow Lab](https://www.agensi.io/creators/creator-1578)
- Category: [DevOps & Cloud](https://www.agensi.io/skills/devops-cloud)
- Version: 1.0.0
- Last updated: 2026-12-03
- Security: scan passed (2026-12-03); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/redeploy-a-live-trading-bot-safely-pm2-go
- Tags: devops, trading, automation, deploy, pm2, go, rollback, env-vars

## What it does

- Checks for new required environment variables to prevent boot crashes
- Verifies the trading account is flat before any service restart
- Creates a timestamped backup of the current binary before overwriting it
- Runs tests directly on the host server to confirm the build is healthy
- Proves the new version is live by finding a specific marker in the logs
- Monitors the process ID and restart counter to ensure stability after launch

## Who it's for

- **Founders running trading bots:** Update your live trading bots without losing money or missing trades. Try: "Redeploy my ETH trader on the Linux server."
- **Freelance developers managing client servers:** Ship updates to live services with a safety net and proof that the new code is actually running. Try: "Update the backend service and check if the new version is live."
- **Small crypto teams:** Keep your trading services stable by catching missing settings before they crash your bots. Try: "Deploy the latest commit to the production host and check the account status."

## About this skill

A careful, repeatable procedure for shipping a new build of a running crypto trading service without an outage or a double-trade. It is written for Go services run under PM2 on a Linux host, and the checks carry over to similar stacks.

What is inside:
- **SKILL.md** - the full procedure: diff the new code's required environment variables against the host's env file so nothing panics at boot, confirm the account is flat before restarting, back up the current binary, build and test on the host, restart by the real process name (not by a guess), and verify with a marker that only the new build prints. It also covers rollback and the control-plane case (HTTP API, Postgres migrations, static admin panel).
- **references/service-types.md** - how the procedure changes per service type, and how to prune old rollback copies while keeping a ledger of which build ran when.
- **scripts/binary_identity.sh** - reads the running binary from the process table and prints its start time, sha256, build settings and module graph, so "is commit X live" is answered from the binary, not from memory.
- **scripts/par_upload.sh** - uploads a binary to several hosts in parallel with a per-host exit line.
- **scripts/swap_binary.sh** - moves the live binary aside, installs the new one, checks the hash.

Who it is for: solo operators and small teams who deploy their own trading services and have been bitten by a missing env var, a half-updated library or a restart in the middle of a position. Needs SSH access, bash and, for Go, a toolchain. Nothing here places trades. Also included in the Crypto Trading Ops Playbooks pack at a lower per-skill price.

## Requires

- bash, curl, sha256sum on the host
- Go toolchain on the host or build machine (for Go services)
- Git

## Known limitations

Requires SSH access to a Linux host with PM2 installed. It is designed for Go services but can adapt to others.

## Technical details

This skill automates a deployment runbook for Go-based services managed by PM2 on Linux. It performs git diffs to find env-var panics, uses SSH for remote commands, and reads /proc/pid/exe to verify binary identity. It handles backups, builds, and log verification to ensure zero-downtime updates and provides a fast rollback path using previous binary copies.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Redeploy a Live Trading Bot Safely (PM2, Go) skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### How does this skill help me avoid losing money during a server update?

This skill helps you update live trading programs running on Linux servers without causing outages. It checks for missing settings that could crash the service, ensures you have no open trades at risk, backs up the old version, and verifies the new version is actually running.

### What do I need to have ready on my server to use this?

You need a Linux server running your service under PM2 (a process manager). You should also have your code in a Git repository and have Go installed on the server if you want to build the program directly on the host.

### What kind of confirmation or report will I see after an update?

The skill will provide a report showing exactly which code versions were shipped, any settings that were changed, and proof that the new version is live. It also creates a backup of your previous program so you can switch back quickly if something goes wrong.

### Are there any situations where I should not use this skill?

This skill is designed for one-at-a-time updates to a single server and should not be used to launch multiple sub-agents at once. It also requires you to provide the specific process names and login details for your server and trading exchanges.

### What are some examples of how I can ask my agent to perform these tasks?

You can tell your agent to update the service on the server, deploy the latest code to the trader, or check if a specific commit is currently live on the box. It works best when you provide the specific folder name and process name for your trading service.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
