npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

strong-pm2

v0.0.9

Published

strong-pm2

Downloads

2

Readme

strong-pm2

安装

  • npm install -g strong-pm2

使用

$ fis-pm\storng-pm2\spm2 #为了向前兼容提供了fis-pm命令
$ spm2 memwatch #检查pm2的子进程内存状况,防止内存泄漏
$ spm2 memwatch -s 250 #对于超过250M的子进程,进行热重启
$ spm2 startOrReload /home/wangcheng/demo/pm2-pro.json #利用pm2-pro.json文件启动引用
$ spm2 daemon /home/wangcheng/demo/pm2-pro.json #pm2的守护进程,pm2自带的upstart功能需要root权限,通常无法使用

目录指定

pm2配置文件

pm2-pro.json 设置pm2的bin位置
[{
    "name" : "pm_app",
    "pm2_bin" : "/home/users/***/pm2/bin" //设置pm2的bin目录,不设置则采用系统默认的
    "node_bin" : "/home/users/***/node/bin" //设置pm2的bin目录
}]

配合crontab命令

可以配置crontab命令定期执行 daemon 和 memwatch 命令。提供定期执行的脚本。

  1. tools/memwatch.sh 和 tools/daemon.sh

这两个脚本过滤了所有报错信息,返回数字。注意修改脚本顶部三个变量值,指定路径。

需要修改的变量

  1. json=/home/**/repos/pm-demo/pm_demo.json 指定spm2配置文件路径
  2. node_bin=/home/**/node/bin 指定node可执行路径
  3. spm2_bin=/home/**/repos/pm-demo/node_modules/strong-pm2/bin/strong-pm2 指定strong-pm2 执行路径

返回值

  • 程序出错返回 -1
  • 程序执行正常返回 0
  • memwatch 重启程序失败返回 -2

使用方式: * * * * * sh /home/someone/repos/pm-demo/node_modules/strong-pm2/tools/memwatch.sh * * * * * sh /home/someone/repos/pm-demo/node_modules/strong-pm2/tools/daemon.sh