0

I am trying to start a python script in pm2 with a a variable.

Without a variable, I would run: pm2 start --name myapp /home/user/myapp/start.py --interpreter ~/myapp_venv/bin/python3

The python command I would like to run is: python3 /home/user/myapp/start.py -cf configs/myapp2.ini

If I activate the virtual environment, I can start the app just fine.

I am looking for the PM2 start command to run this in PM2.

Also, I would like to stop the pm2 logs from generating and writing as I log in my own app, so they are useless writes for me. Something like the below I thought would work adding into the PM2 start script. -o "/dev/null" -e "/dev/null"

If anyone would be able to advise on the PM2 start command to run this app with the viable in PM2, I would be very grateful.

Ben Doyle
  • 3
  • 2

1 Answers1

0

I have since found the answer to my own question.

Run the below command from the myapp directory:

pm2 start "~/myapp_venv/bin/python3 start.py -cf configs/myapp2.ini" --name myapp2

Ben Doyle
  • 3
  • 2