PM2使用

福尔摩斯对我笑 2018-12-20 15914 次 4042条

全局安装

cnpm install -g pm2
  • 启动并监听当前目录
pm2 start index.js --watch

启动参数说明:

  • --watch:监听应用目录的变化,一旦发生变化,自动重启。如果要精确监听、不见听的目录,最好通过配置文件。
  • -i --instances:启用多少个实例,可用于负载均衡。如果-i 0或者-i max,则根据当前机器核数确定实例数目。
  • --ignore-watch:排除监听的目录/文件,可以是特定的文件名,也可以是正则。比如--ignore-watch="test node_modules "some scripts""
  • -n --name:应用的名称。查看应用信息的时候可以用到。
  • -o --output <path>:标准输出日志文件的路径。
  • -e --error <path>:错误输出日志文件的路径。
  • --interpreter <interpreter>:the interpreter pm2 should use for executing app (bash, python...)。比如你用的coffee script来编写应用。

重启

pm2 restart app.js

###停止 停止特定的应用。可以先通过pm2 list获取应用的名字(--name指定的)或者进程id。

pm2 stop app_name|app_id

如果要停止所有应用,可以

pm2 stop all

查看日志

pm2 log

就可以查看console.log的输出了

PM2支持NPM启动:pm2 start npm -- start

pm2 monit 监视每个node进程的CPU和内存的使用情况

pm2 delete all                # 关闭并删除所有应用

pm2 delete 0                  # 删除指定应用 id 0

npm方式启动

pm2 start npm -- run development

//启动express
pm2 start ./bin/www --watch

//带名字启动

pm2 start npm --watch --name XXX -- run start

APPNode配置

标签: 无

非特殊说明,本博所有文章均为博主原创。

上一篇
头像也是LOGO
未来博客 博主大人
到了这个年纪,不应该再彷徨!

发表评论



 


已有 4042 条评论 1


  1. squirrel.design.blog

    This is really interesting, You’re a very skilled blogger.
    I have joined your rss feed and look forward to seeking more of your wonderful post.
    Also, I’ve shared your site in my social networks!

    回复 2020年2月26日
  2. 예스카지노

    But then…. The poison would be “Hindu women vs Muslim women”.

    संघी बहुत कुत्ती चीज़ हैं राम https://todcm.ddns.net/blog/2020/02/15/wine-decanter-types-for-your-house-bar-7/

    回复 2020年2月26日
  3. gooseberey.tech.blog

    Someone necessarily help to make significantly posts I would state.
    That is the first time I frequented your web page and up to now?
    I surprised with the research you made to create this actual publish incredible.
    Wonderful job!

    回复 2020年2月26日
  4. viagra

    Hi there! Do you use Twitter? I’d like to follow you if that would be ok.
    I’m undoubtedly enjoying your blog and look forward to new updates.

    回复 2020年2月26日
  5. bloody hell

    When I originally commented I appear to have clicked on the -Notify me when new comments are added- checkbox and from now on every time a comment is added I get four emails with the same comment. Is there an easy method you are able to remove me from that service? Many thanks!

    回复 2020年2月26日
  6. fuck

    I’m amazed, I have to admit. Seldom do I encounter a blog that’s equally educative and engaging, and without a doubt, you have hit the nail on the head. The problem is something too few men and women are speaking intelligently about. I am very happy that I stumbled across this in my hunt for something relating to this.

    回复 2020年2月26日
  7. Cheap towing

    I loved as much as you’ll receive carried out right here.
    The sketch is attractive, your authored subject matter stylish.
    nonetheless, you command get got an shakiness over that you wish be delivering the following.
    unwell unquestionably come more formerly again as exactly the same nearly a lot often inside case you shield this hike.

    回复 2020年2月26日
  8. jasa pembuatan sbu

    Very good blog post. I definitely appreciate this site. Thanks!

    回复 2020年2月26日
  9. coon

    An impressive share! I’ve just forwarded this onto a co-worker who had been conducting a little homework on this. And he actually ordered me breakfast due to the fact that I discovered it for him… lol. So let me reword this…. Thanks for the meal!! But yeah, thanks for spending time to discuss this subject here on your web site.

    回复 2020年2月26日
  10. homoerotic

    I blog frequently and I genuinely appreciate your content. The article has really peaked my interest. I am going to take a note of your website and keep checking for new details about once a week. I opted in for your Feed too.

    回复 2020年2月26日
  11. cunt

    Good write-up. I definitely love this website. Continue the good work!

    回复 2020年2月26日
  12. 룰렛 게임

    Fantastic site you have here but I was curious about if you
    knew of any forums that cover the same topics talked about in this article?

    I’d really like to be a part of group where I can get opinions from other
    knowledgeable people that share the same interest. If you have any recommendations, please let
    me know. Thanks a lot!

    回复 2020年2月26日
  13. orgasm

    There is certainly a lot to learn about this issue. I like all of the points you made.

    回复 2020年2月26日
  14. asshole

    This is a topic which is close to my heart… Best wishes! Exactly where are your contact details though?

    回复 2020年2月26日
  15. 더킹 카지노

    I think the admin of this web page is genuinely working hard in favor of his
    site, for the reason that here every information is quality based stuff.

    回复 2020年2月26日
  16. coonnass

    Next time I read a blog, I hope that it won’t disappoint me as much as this one. After all, I know it was my choice to read, however I truly thought you’d have something helpful to talk about. All I hear is a bunch of moaning about something you could possibly fix if you weren’t too busy seeking attention.

    回复 2020年2月26日
  17. 바카라 사이트

    Every weekend i used to go to see this web site, as
    i want enjoyment, since this this site conations actually fastidious funny material too.

    回复 2020年2月26日
  18. 로투스 홀짝 게임

    I loved as much as you will receive carried out right here.
    The sketch is attractive, your authored material stylish.
    nonetheless, you command get bought an shakiness over that you
    wish be delivering the following. unwell unquestionably come further formerly again since exactly the same nearly
    a lot often inside case you shield this hike.

    回复 2020年2月26日
  19. kd 11 shoes

    I’m commenting to let you be aware of what a helpful encounter my wife’s child developed viewing your site. She discovered lots of things, including what it is like to possess an excellent giving style to let men and women without problems fully grasp specified very confusing things. You actually did more than readers’ expectations. Many thanks for showing these beneficial, healthy, educational not to mention unique tips about this topic to Mary.

    回复 2020年2月26日
  20. negro

    I was able to find good information from your articles.

    回复 2020年2月26日
  21. motherfucker

    I could not resist commenting. Exceptionally well written!

    回复 2020年2月26日
  22. fag

    I was able to find good advice from your articles.

    回复 2020年2月26日
  23. 예스 카지노

    Amazing! This blog looks just like my old one! It’s on a totally different topic but it has pretty much the same layout
    and design. Great choice of colors!

    回复 2020年2月26日
  24. 예스 카지노

    You made some good points there. I checked on the net for
    more information about the issue and found most individuals will go along with your views on this site.

    回复 2020年2月26日
  25. piss off

    Can I just say what a comfort to discover an individual who really knows what they are talking about online. You certainly understand how to bring an issue to light and make it important. A lot more people really need to read this and understand this side of your story. I can’t believe you are not more popular because you surely possess the gift.

    回复 2020年2月26日
  26. damn

    This web site truly has all the info I wanted concerning this subject and didn’t know who to ask.

    回复 2020年2月26日
  27. Kiacycle 回复 2020年2月26日
  28. xxx free porn movies

    I know this if off topic but I’m looking into starting my
    own weblog and was curious what all is required to
    get setup? I’m assuming having a blog like yours would cost a pretty penny?
    I’m not very web smart so I’m not 100% sure. Any tips or advice
    would be greatly appreciated. Thank you

    回复 2020年2月26日
  29. lexus888 versi mobile

    Excellent site you have got here.. It’s difficult
    to find high-quality writing like yours nowadays.
    I honestly appreciate people like you! Take care!!

    回复 2020年2月26日
  30. torque control bolts

    Hi there! I understand this is kind of off-topic but I had to ask. Does building a well-established website such as yours take a large amount of work? I’m brand new to running a blog but I do write in my diary every day. I’d like to start a blog so I can share my experience and thoughts online. Please let me know if you have any recommendations or tips for new aspiring blog owners. Thankyou!

    回复 2020年2月26日
  31. hore

    Hi, I do think this is an excellent website. I stumbledupon it 😉 I will return once again since i have saved as a favorite it. Money and freedom is the best way to change, may you be rich and continue to help others.

    回复 2020年2月25日
  32. humphreyty.wordpress.com

    Link exchange is nothing else but it is only placing the other person’s
    web site link on your page at proper place and other person will also do same in favor of you.

    回复 2020年2月25日
  33. modern building construction

    Hi there, i read your blog from time to time and i own a similar one and i was just curious if you get a lot of spam responses? If so how do you protect against it, any plugin or anything you can suggest? I get so much lately it’s driving me insane so any assistance is very much appreciated.

    回复 2020年2月25日
  34. lexus888 515

    Great blog right here! Also your site a lot up very fast!

    What host are you the use of? Can I get your affiliate hyperlink to your
    host? I want my site loaded up as fast as
    yours lol

    回复 2020年2月25日
  35. 모나코 카지노

    Hi, always i used to check webpage posts here in the early
    hours in the morning, since i love to learn more and more.

    回复 2020年2月25日
  36. anal

    Can I simply just say what a relief to uncover a person that really knows what they are discussing over the internet. You definitely realize how to bring an issue to light and make it important. More and more people need to look at this and understand this side of your story. I can’t believe you’re not more popular given that you certainly have the gift.

    回复 2020年2月25日
  37. bitch

    I used to be able to find good information from your blog articles.

    回复 2020年2月25日
  38. 샌즈 카지노

    Heya i’m for the first time here. I found this board and I to find It really useful
    & it helped me out a lot. I’m hoping to give one thing again and aid others like you aided me.

    回复 2020年2月25日
  39. a325n tc bolts

    Awesome blog! Do you have any tips and hints for aspiring writers? I’m planning to start my own site soon but I’m a little lost on everything. Would you advise starting with a free platform like WordPress or go for a paid option? There are so many options out there that I’m completely confused .. Any recommendations? Thank you!

    回复 2020年2月25日
  40. SM 카지노

    This is the right webpage for everyone who really wants
    to find out about this topic. You know so much its almost hard to argue with you (not that I actually
    will need to…HaHa). You definitely put a brand new spin on a subject
    that has been written about for years. Excellent stuff, just great!

    回复 2020年2月25日
  41. whore

    This is a topic that’s close to my heart… Many thanks! Where are your contact details though?

    回复 2020年2月25日
  42. escort

    An impressive share! I’ve just forwarded this onto a co-worker who was conducting a little research on this. And he in fact ordered me lunch simply because I discovered it for him… lol. So let me reword this…. Thank YOU for the meal!! But yeah, thanx for spending time to talk about this topic here on your web page.

    回复 2020年2月25日
  43. cryptocurrency

    Hello, yeah this article is really fastidious and I have learned lot of things from it regarding blogging.
    thanks.

    回复 2020年2月25日
  44. โปรโมชั่นยูฟ่าเบท

    โปรโมชั่นUFABET ที่ UFA089 รับโบนัส 20% สูงสุดไม่เกิน 5,000 บาท

    回复 2020年2月25日
  45. w88

    Do you have a spam problem on this website; I also am a blogger, and I was wanting to
    know your situation; many of us have developed some nice procedures and
    we are looking to exchange strategies with others, why not shoot me an e-mail if interested.

    回复 2020年2月25日
  46. 인터넷 카지노

    Hi, I think your blog might be having browser compatibility issues.

    When I look at your website in Ie, it looks fine but when opening in Internet Explorer,
    it has some overlapping. I just wanted to give you a quick heads up!
    Other then that, great blog!

    回复 2020年2月25日
  47. 우리카지노

    प्रधानमंत्री फसल बीमा योजना को आज ज़बरदस्ती नहीं,
    ऐच्छिक करने का भाजपा का
    वादा, ये दर्शाता है कि इसमें खतरनाक लूट हुई है किसान के … https://worxia.com/?p=122402

    回复 2020年2月25日