PM3


NamePM3 JSON
Version 0.3.29 PyPI version JSON
download
home_page
SummaryLike pm2 without node.js ;-)
upload_time2024-02-29 16:52:34
maintainer
docs_urlNone
author
requires_python>=3.9
license
keywords pm3
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PM3
Like pm2 without node.js ;-)
![](https://github.com/ilariofebi/PM3/blob/main/screenshots/ls.png?raw=true)
# PM3 CheatSheet:
### Install and update
Build a [virtualenv](https://docs.python.org/3.9/tutorial/venv.html) environment (recommended)
```
python3.9 -m venv PM3venv
. PM3venv/bin/activate
```
Then:
```
pip install pm3             # Install pm3
pip install -U pm3          # Upgrade pm3
```

### Start
```
pm3 daemon start    # Start process with default ~/.pm3/config.ini configuration 
pm3 ping            # Ensure pm3 daemon has been launched
```

### Create new process
```
pm3 new '/bin/sleep 10' -n sleep10                                  # Create a new process with name sleep10
pm3 new '/bin/sleep 10' -n sleep10 --autorun                        # Create a new process with autorun option
pm3 new "script.py" --interpreter "/venv/bin/python" --cwd "/tmp"   # Create a new process with interpreter and cwd definition
pm3 new '/bin/sleep 5' --max-restart 10 --autorun                   # Stops restarting the process after 10 restarts        
```
### Actions
```
pm3 start sleep10   # Start process with name sleep10
pm3 start 1         # Start process with id 1
pm3 restart all     # Restart all process
pm3 stop 2          # Stop process with id 2 
pm3 rm 3            # Stop and delete process with id 3
```

### Listing
```
pm3 ls                 # Display all processes
pm3 ls -l              # Display all processes in list format
pm3 ls -j              # Display all processes in json format
pm3 ps 5               # Display process 5 status
pm3 ps -l ALL          # Display ALL processes (hidden or not) status in list format
pm3 ps -j ALL          # Display ALL processes (hidden or not) status in json format
```

### Dump and Load
```
pm3 dump 2                  # Print process 2 configuration in JSON
pm3 dump all -f dump.json   # Save all configuration processes in dump.json file 
pm3 load dump.json          # Load all configuration processes from dump.json file 
```

### Logs
```
pm3 log            # Display all processes logs
pm3 log 5 -f       # Display and follow log of process 5
pm3 err 2 -n 50    # Display last 50 rows of process 5 error log 
pm3 flush 1 log    # Empty log file of process 1
pm3 flush all err  # Empty err file of all process
```

### Useful script generation
```
pm3 make_script systemd     # Generate script for install startup systemd configuration
```

### Misc
```
pm3 reset 2                 # Reset meta data of process id 2
pm3 ping [-v]               # Ensure pm3 daemon has been launched [verbose]
pm3 rename 3 -n <new_name>  # Rename process id 3 with a <new_name>
pm3 -h                      # General help
pm3 new -h                  # Help of new subcommand  
```

### Daemon commands
```
pm3 daemon start        # Start PM3 backend porcess
pm3 daemon stop         # Stop PM3 backend porcess
pm3 daemon status       # Check daemon status details
```

# Configuration file:
`$ cat ~/.pm3/config.ini`
```
[main_section]
pm3_home_dir = /home/user/.pm3                  # pm3 home dir
pm3_db = /home/user/.pm3/pm3_db.json            # TinyDB Store File
pm3_db_process_table = pm3_procs                # TinyDB process table
main_interpreter = /home/user/venv/bin/python   # path of python interpreter

[backend]
name = __backend__                       # name of backend process (hidden process)
url = http://127.0.0.1:7979/             # proto://ip:port of backend (if != 127.1 is a potential RISK!!)
cmd = /home/user/venv/bin/pm3_backend    # path of backend command

[cron_checker]
name = __cron_checker__                      # name of backend process (hidden process)
cmd = /home/user/venv/bin/pm3_cron_checker   # path of cron checker command
sleep_time = 5                               # Time (in seconds) to check process                            
debug = False                                # Crocn Checker debug info
```


## Autocompletition (experimental)
### Bash
```
pm3_exe=$(which pm3)
eval "$(register-python-argcomplete $pm3_exe)"
```

### Fish
```
pm3_exe=$(which pm3)
register-python-argcomplete --shell fish $pm3_exe | source
```
or
```
register-python-argcomplete --shell fish $pm3_exe > ~/.config/fish/completions/pm3.fish
```

### Other shell
visit https://kislyuk.github.io/argcomplete/



            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "PM3",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "PM3",
    "author": "",
    "author_email": "Ilario Febi <i.febi@febi.biz>, Massimiliano Salvemini <ms.salvemini@gmail.com>",
    "download_url": "",
    "platform": null,
    "description": "# PM3\nLike pm2 without node.js ;-)\n![](https://github.com/ilariofebi/PM3/blob/main/screenshots/ls.png?raw=true)\n# PM3 CheatSheet:\n### Install and update\nBuild a [virtualenv](https://docs.python.org/3.9/tutorial/venv.html) environment (recommended)\n```\npython3.9 -m venv PM3venv\n. PM3venv/bin/activate\n```\nThen:\n```\npip install pm3             # Install pm3\npip install -U pm3          # Upgrade pm3\n```\n\n### Start\n```\npm3 daemon start    # Start process with default ~/.pm3/config.ini configuration \npm3 ping            # Ensure pm3 daemon has been launched\n```\n\n### Create new process\n```\npm3 new '/bin/sleep 10' -n sleep10                                  # Create a new process with name sleep10\npm3 new '/bin/sleep 10' -n sleep10 --autorun                        # Create a new process with autorun option\npm3 new \"script.py\" --interpreter \"/venv/bin/python\" --cwd \"/tmp\"   # Create a new process with interpreter and cwd definition\npm3 new '/bin/sleep 5' --max-restart 10 --autorun                   # Stops restarting the process after 10 restarts        \n```\n### Actions\n```\npm3 start sleep10   # Start process with name sleep10\npm3 start 1         # Start process with id 1\npm3 restart all     # Restart all process\npm3 stop 2          # Stop process with id 2 \npm3 rm 3            # Stop and delete process with id 3\n```\n\n### Listing\n```\npm3 ls                 # Display all processes\npm3 ls -l              # Display all processes in list format\npm3 ls -j              # Display all processes in json format\npm3 ps 5               # Display process 5 status\npm3 ps -l ALL          # Display ALL processes (hidden or not) status in list format\npm3 ps -j ALL          # Display ALL processes (hidden or not) status in json format\n```\n\n### Dump and Load\n```\npm3 dump 2                  # Print process 2 configuration in JSON\npm3 dump all -f dump.json   # Save all configuration processes in dump.json file \npm3 load dump.json          # Load all configuration processes from dump.json file \n```\n\n### Logs\n```\npm3 log            # Display all processes logs\npm3 log 5 -f       # Display and follow log of process 5\npm3 err 2 -n 50    # Display last 50 rows of process 5 error log \npm3 flush 1 log    # Empty log file of process 1\npm3 flush all err  # Empty err file of all process\n```\n\n### Useful script generation\n```\npm3 make_script systemd     # Generate script for install startup systemd configuration\n```\n\n### Misc\n```\npm3 reset 2                 # Reset meta data of process id 2\npm3 ping [-v]               # Ensure pm3 daemon has been launched [verbose]\npm3 rename 3 -n <new_name>  # Rename process id 3 with a <new_name>\npm3 -h                      # General help\npm3 new -h                  # Help of new subcommand  \n```\n\n### Daemon commands\n```\npm3 daemon start        # Start PM3 backend porcess\npm3 daemon stop         # Stop PM3 backend porcess\npm3 daemon status       # Check daemon status details\n```\n\n# Configuration file:\n`$ cat ~/.pm3/config.ini`\n```\n[main_section]\npm3_home_dir = /home/user/.pm3                  # pm3 home dir\npm3_db = /home/user/.pm3/pm3_db.json            # TinyDB Store File\npm3_db_process_table = pm3_procs                # TinyDB process table\nmain_interpreter = /home/user/venv/bin/python   # path of python interpreter\n\n[backend]\nname = __backend__                       # name of backend process (hidden process)\nurl = http://127.0.0.1:7979/             # proto://ip:port of backend (if != 127.1 is a potential RISK!!)\ncmd = /home/user/venv/bin/pm3_backend    # path of backend command\n\n[cron_checker]\nname = __cron_checker__                      # name of backend process (hidden process)\ncmd = /home/user/venv/bin/pm3_cron_checker   # path of cron checker command\nsleep_time = 5                               # Time (in seconds) to check process                            \ndebug = False                                # Crocn Checker debug info\n```\n\n\n## Autocompletition (experimental)\n### Bash\n```\npm3_exe=$(which pm3)\neval \"$(register-python-argcomplete $pm3_exe)\"\n```\n\n### Fish\n```\npm3_exe=$(which pm3)\nregister-python-argcomplete --shell fish $pm3_exe | source\n```\nor\n```\nregister-python-argcomplete --shell fish $pm3_exe > ~/.config/fish/completions/pm3.fish\n```\n\n### Other shell\nvisit https://kislyuk.github.io/argcomplete/\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Like pm2 without node.js ;-)",
    "version": "0.3.29",
    "project_urls": null,
    "split_keywords": [
        "pm3"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "370560ea7b7b03b7a61f8c8b452acd242b779a3473e7144393843a4dccc3aa7b",
                "md5": "253a48bb325122b35a1be4ca0d1d3f33",
                "sha256": "c63d1fd0b44d07a79dec00f4c0c838cb9643bd528588f5dbd84890079e9dfb60"
            },
            "downloads": -1,
            "filename": "PM3-0.3.29-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "253a48bb325122b35a1be4ca0d1d3f33",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 31415,
            "upload_time": "2024-02-29T16:52:34",
            "upload_time_iso_8601": "2024-02-29T16:52:34.773206Z",
            "url": "https://files.pythonhosted.org/packages/37/05/60ea7b7b03b7a61f8c8b452acd242b779a3473e7144393843a4dccc3aa7b/PM3-0.3.29-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-29 16:52:34",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pm3"
}
        
Elapsed time: 0.81166s