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 test.sh:
#!/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:)
Hi @xzycn
You can try pm2 start "pipenv run python -m scripts.script1".
@wallet77 it works as expected, thank you :)
But, I think the usage should be written in documents :)
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:
apps:
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
:)
Most helpful comment
Writing here for other people who want to know how to write the above command:
into an ecosystem file pm2.yml.
After some diggings:
then,you can start the script1 in command line directly:
:)