Files
iris-context/commands/ops/pm2.go
VERSE ebde9ba68f refactor(commands): separate commands and its core into two folders (#32)
- I think it would be better if one for commands only, one for the spec
handling core logic so people won't be confused by the core logic inside
the commands folder (cleaner I guess)
- Regen docs
2026-07-05 11:27:30 +07:00

103 lines
6.6 KiB
Go

package ops
import (
"github.com/versenilvis/iris/spec"
)
func init() {
spec.Register(&spec.Spec{
Name: "pm2",
Description: "Outputs the version number",
Subcommands: []spec.Subcommand{
{Name: "start", Description: "Starts and daemonizes an app"},
{Name: "trigger", Description: "Deploy your json"},
{Name: "deploy", Description: "Deploy your json"},
{Name: "startOrRestart", Description: "Start or restart JSON file"},
{Name: "startOrReload", Description: "Start or gracefully reload JSON file"},
{Name: "pid", Description: "Return pid of the specified app or all"},
{Name: "startOrGracefulReload", Description: "Start or gracefully reolad JSON file"},
{Name: "stop", Description: "Stop a process"},
{Name: "restart", Description: "Restart a process"},
{Name: "scale", Description: "Scale up/down a process in cluster mode depending on the `number` param"},
{Name: "snapshot", Description: "Snapshot PM2 memory"},
{Name: "profile", Description: "Profile CPU"},
{Name: "reload", Description: "Reload processes (for apps using HTTP/HTTPS)"},
{Name: "gracefulReload", Description: "Gracefully reload a process. Send a “shutdown” message to close all connections"},
{Name: "id", Description: "Get process id by name"},
{Name: "delete", Description: "Stops and deletes a process from pm2 process list"},
{Name: "sendSignal", Description: "Send a system signal to the target process"},
{Name: "ping", Description: "Ping pm2 daemon - if not it will launch up"},
{Name: "updatePM2", Description: "Update in-memory PM2 with local PM2"},
{Name: "update", Description: "(alias) update in-memory PM2 with local PM2"},
{Name: "install", Description: "Install or update a module and run it forever"},
{Name: "module:generate", Description: "Generate a sample module in current folder"},
{Name: "uninstall", Description: "Stop and uninstall a module"},
{Name: "publish", Description: "Publish the module you are currently on"},
{Name: "set", Description: "Sets the specified config"},
{Name: "multiset", Description: "Multiset eg `key1 val1 key2 val2`"},
{Name: "get", Description: "Get value for the specified key"},
{Name: "conf", Description: "Get / set module config values"},
{Name: "config", Description: "Get / set module config values"},
{Name: "unset", Description: "Clears the specified config key"},
{Name: "report", Description: "Give a full pm2 report for https://github.com/Unitech/pm2/issues"},
{Name: "link", Description: "Linking action to keymetrics.io"},
{Name: "unlink", Description: "Linking action to keymetrics.io"},
{Name: "unmonitor", Description: "Unmonitor target process"},
{Name: "monitor", Description: "<Unm>onitor target process"},
{Name: "open", Description: "Open dashboard in browser"},
{Name: "register", Description: "Create an account on keymetrics"},
{Name: "login", Description: "Login to keymetrics and link current PM2"},
{Name: "web", Description: "Launch a health API on 0.0.0.0:9615"},
{Name: "dump", Description: "Dump all processes for resurrecting them later"},
{Name: "send", Description: "Send stdin to pm id"},
{Name: "attach", Description: "Attach stdin/stdout to application identified by pm id"},
{Name: "resurrect", Description: "Resurrect previously dumped processes"},
{Name: "unstartup", Description: "Disable and clear auto startup"},
{Name: "startup", Description: "Setup script for pm2 at boot"},
{Name: "logrotate", Description: "Copy default logrotate configuration"},
{Name: "ecosystem", Description: "Generate a process conf file"},
{Name: "reset", Description: "Reset counters for process"},
{Name: "describe", Description: "Describe all parameters of a process id"},
{Name: "desc", Description: "(alias) Describe all parameters of a process id"},
},
Options: []spec.Option{
{Name: "-V", Description: "Outputs the version number"},
{Name: "-v", Description: "Gets version"},
{Name: "-s", Description: "Hides all messages"},
{Name: "-m", Description: "Displays a compacted list without formatting"},
{Name: "-f", Description: "Forces actions"},
{Name: "--disable-logs", Description: "Do not write logs"},
{Name: "-n", Description: "Sets a name for script"},
{Name: "-i", Description: "Launches [number] instances (for networked app)(load balanced)"},
{Name: "--parallel", Description: "Number of parallel actions (for restart/reload)"},
{Name: "-l", Description: "Specifies entire log file (error and out are both included)"},
{Name: "-o", Description: "Specifies out log file"},
{Name: "-e", Description: "Specifies error log file"},
{Name: "-p", Description: "Specify pid file"},
{Name: "-k", Description: "Delays before sending final SIGKILL signal to process"},
{Name: "--listen-timeout", Description: "Listen timeout on application reload"},
{Name: "--max-memory-restart", Description: "Specify max memory amount used to autorestart (in octet or use syntax like 100M)"},
{Name: "--restart-delay", Description: "Specify a delay between restarts (in milliseconds)"},
{Name: "--env", Description: "Specify environment to get specific env variables"},
{Name: "--log-type", Description: "Specify log output style (raw by default, json optional)"},
{Name: "-x", Description: "Execute a program using fork system"},
{Name: "--max-restarts", Description: "Only Restart the script COUNT times"},
{Name: "-u", Description: "Defines user when generating startup script"},
{Name: "--uid", Description: "Runs target script with <uid> rights"},
{Name: "--gid", Description: "Runs target script with <gid> rights"},
{Name: "--cwd", Description: "Runs target script as <username>"},
{Name: "--hp", Description: "Defines home path when generating startup script"},
{Name: "--wait-ip", Description: "Overrides systemd script to wait for full internet connectivity to launch pm2"},
{Name: "--service-name", Description: "Defines service name when generating startup script"},
{Name: "-c", Description: "Restarts a running process based on a cron pattern"},
{Name: "-w", Description: "Writes configuration in local folder"},
{Name: "--interpreter", Description: "The interpreter pm2 should use for executing app (bash, python…)"},
{Name: "--interpreter-args", Description: "Interprets options (alias of --node-args)"},
{Name: "--log-date-format", Description: "Adds custom prefix timestamp to logs"},
{Name: "--no-daemon", Description: "Runs pm2 daemon in the foreground if it doesn't exist already"},
{Name: "-a", Description: "Updates environment on restart/reload (-a <=> apply)"},
{Name: "-h", Description: "Outputs usage information"},
},
})
}