https://github.com/dunstorm/pm2-go
A pm2 clone built with go
https://github.com/dunstorm/pm2-go
automation golang hacktoberfest
Last synced: 6 months ago
JSON representation
A pm2 clone built with go
- Host: GitHub
- URL: https://github.com/dunstorm/pm2-go
- Owner: dunstorm
- License: other
- Created: 2022-06-02T13:36:51.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-11-25T05:28:48.000Z (7 months ago)
- Last Synced: 2025-11-28T14:00:53.745Z (7 months ago)
- Topics: automation, golang, hacktoberfest
- Language: Go
- Homepage:
- Size: 5.3 MB
- Stars: 72
- Watchers: 2
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://i.imgur.com/wUgcD2t.png)
# PM2-GO
[](https://goreportcard.com/report/github.com/dunstorm/pm2-go)
PM2-GO is a clone of [Unitech/pm2](https://github.com/Unitech/pm2) made using golang. The aim is to make it easy to install. Performance is the bonus.
Starting an application in production mode is as easy as:
```
pm2-go start python app.py
```
Works on Linux & macOS, no support for Windows.
## Start an application
You can start any application (Node.js, Python, Ruby, binaries in $PATH...) like that:
```
pm2-go start python app.py
```
## Managing Applications
Once applications are started you can manage them easily:
To list all running applications:
```
pm2-go ls
```
Managing apps is straightforward:
```
pm2-go stop
pm2-go restart
pm2-go delete
pm2-go flush
```
To see real-time logs:
```
pm2-go logs
```
To dump all processes
```
pm2-go dump
```
To restore all processes
```
pm2-go restore
```
## Extend Logs
Logs can be extended by using `scripts` placed in `$HOME/.pm2-go/scripts`.
To leverage the use of `scripts`, specify the `scripts` inside `.json` file containing processes
e.g.
```json
[
{
"name": "python-test",
"args": ["-u", "test.py"],
"autorestart": true,
"cwd": "./examples",
"scripts": ["logs_date"],
"executable_path": "python3",
"cron_restart": "* * * * *"
}
]
```
Example script: [logs_date.sh](https://github.com/dunstorm/pm2-go/blob/main/scripts/logs_date.sh)
It adds corresponding date & time to each line from the process output

## Log Rotation
Log rotation can be enabled by setting `logrotate` to `true` using
```
pm2-go config set logrotate true
```
Logs will be rotated every `x` size (default: 10MB) and `y` number of files (default: 10). It can be configured using
```
pm2-go config set logrotate_size 10M (e.g. 10M, 10K, 10G)
pm2-go config set logrotate_max_files 10
```