[英]Can PM2 run command line start scripts?
I'm using a library, say I want the script that starts my app to be cli-lib start
how can i go about that?我正在使用一个库,假设我希望启动我的应用程序的脚本是
cli-lib start
我怎么能 go 呢? I don't want to just run node app.js
or any js file for that matter, the cli lib does that for me but i cant figure out a way to get this to work.我不想为此只运行
node app.js
或任何 js 文件,cli lib 为我做这些,但我想不出一种方法来让它工作。
Yes you can run any process type with pm2.是的,您可以使用 pm2 运行任何进程类型。 For scripts in other languages which has assigned an interpreter by default,
对于默认分配解释器的其他语言的脚本,
pm2 start echo.coffee
pm2 start echo.php
pm2 start echo.py
pm2 start echo.sh
pm2 start echo.rb
or with interpreter或带口译员
pm2 start echo.pl --interpreter=perl
I think you can create a bash script then run it with pm2, for examples:我认为您可以创建一个 bash 脚本,然后使用 pm2 运行它,例如:
bash.sh bash.sh
#!/usr/bin/bash
node /home/user/test.js
then you can run file "bash.sh" with pm2然后你可以用pm2运行文件“bash.sh”
pm2 start bash.sh
I did not test it yet but you can try.我还没有测试它,但你可以试试。
Yes we can use & operate pm2 related command with script in Linux.是的,我们可以在 Linux 中通过脚本使用和操作 pm2 相关命令。
$ sudo nano runpm2.sh
#!/usr/bin/bash
pm2 restart "a"
pm2 restart "b"
pm2 restart "c"
pm2 start "app.js"
pm2 restart "app_name"
pm2 reload "app_name"
pm2 stop "app_name"
pm2 delete "app_name"
sudo chmod +x runpm2.sh
sudo ./runpm2.sh
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.