Skip to main content

Like pm2 without node.js ;-)

Project description

PM3

Like pm2 without node.js.

Installation

Create a virtual environment and install PM3:

python3 -m venv .venv
source .venv/bin/activate
pip install pm3

To upgrade:

pip install -U pm3

Quick start

pm3 daemon start
pm3 ping

Create and manage a process:

pm3 new "/bin/sleep 10" -n sleep10 --autorun
pm3 start sleep10
pm3 stop sleep10
pm3 rm sleep10

Useful commands

pm3 ls
pm3 ls -l
pm3 ls -j
pm3 ps all
pm3 dump all -f dump.json
pm3 load -f dump.json
pm3 log all -f
pm3 err all -n 50
pm3 flush all all
pm3 version

Configuration

Default config file: ~/.pm3/config.ini

[main_section]
pm3_home_dir = /home/user/.pm3
pm3_db = /home/user/.pm3/pm3_db.json
pm3_db_process_table = pm3_procs
main_interpreter = /home/user/venv/bin/python
max_backups = 20
log_max_bytes = 10485760
log_backup_count = 5
log_compress = true

[backend]
name = __backend__
url = http://127.0.0.1:7979/
cmd = /home/user/venv/bin/pm3_backend

[cron_checker]
name = __cron_checker__
cmd = /home/user/venv/bin/pm3_cron_checker
sleep_time = 5
debug = False

Backup and recovery

PM3 creates compressed backups of the TinyDB file before write operations. Backups are stored in ~/.pm3/backups/.

If the database is corrupted at startup, PM3 prints a restore hint. Manual restore example:

gunzip -c ~/.pm3/backups/pm3_db_YYYYMMDD_HHMMSS.json.gz > ~/.pm3/pm3_db.json

Log rotation

Process log files are managed through RotatingFileHandler and can be configured with:

  • log_max_bytes
  • log_backup_count
  • log_compress

When log_compress=true, rotated logs are gzip-compressed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pm3-0.5.0.tar.gz (454.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pm3-0.5.0-py3-none-any.whl (32.6 kB view details)

Uploaded Python 3

File details

Details for the file pm3-0.5.0.tar.gz.

File metadata

  • Download URL: pm3-0.5.0.tar.gz
  • Upload date:
  • Size: 454.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for pm3-0.5.0.tar.gz
Algorithm Hash digest
SHA256 ca1bf7fc69720f7c9ebc4ec9ea19b346c60975d9c004597f5a52d82548a7643b
MD5 edd0b8e62c42056bd5ff7bf2a00af529
BLAKE2b-256 746fdf475ef1e2b71f1296bcb388fc1bf9373085f4bd4f5aae99dbed40791f28

See more details on using hashes here.

File details

Details for the file pm3-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: pm3-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 32.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for pm3-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a5d264d9d187a14addd063b5de4578888cae64eb30f4ce756fd8acba32076ba7
MD5 e9b651ae250df3e3fdf8b32cf6470a8d
BLAKE2b-256 3febb8fdc4af37380b5a4c0195ae7c118206c9b784a9b818c370109ba51e885c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page