I am trying to start a python script in pm2 with aa 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.
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.