Solvedpm2 How to start a script in python's module type with pipenv?

I'm using the pipenv in my project, if I want to start a script through the way run as a module: python -m,so, my command like this:

pipenv run python -m scripts.script1

I don't know how to make this work with pm2, it seems that there is no document about this case:(

Although, I write the commands in a shell script like

#!/usr/bin/env bash
pipenv run python -m scripts.script1

,and run the script with pm2:

pm2 start test.bash --interpreter bash

Sort of, it works.

I want to know a better way to achieve this,if it exists :)
Thank you in advance:)

4 Answers

✔️Accepted Answer

Writing here for other people who want to know how to write the above command:

pm2 start "pipenv run python -m scripts.script1"

into an ecosystem file pm2.yml.
After some diggings:

    script: '/bin/bash' 
    name: 'script1'
    args:  ['-c', 'pipenv run python -m scripts.script1']

then,you can start the script1 in command line directly:

pm2 start pm2.yml


More Issues: