How to pass arguments to app using pm2?

后端 未结 10 1156
予麋鹿
予麋鹿 2020-12-07 17:29

I am using pm2 to start my app but i am not able to pass argument to it. the command I am using is pm2 start app.js -- dev. Though this works with forever.

10条回答
  •  太阳男子
    2020-12-07 17:49

    I always use PM2 to run my python scripts in Linux environment. So consider a script has a single parameter and needs to run continously after some amount if time, then we can pass it like this:

    pm2 start  --name  --interpreter  --restart-delay  --  
    

    filename.py is Name of the python script, without <> symbols, I want to run using PM2
    nameForJob is the Meaningful name for the job, without <> symbols
    InterpreterName is the python interpreter for running script, usually it is python3 in linux
    timeinMilliseconds is the time our script needs to wait and re-run again
    param1 is the first parameter for the script
    param2 is the second parameter for the script.

提交回复
热议问题