美文网首页
pm2 startup

pm2 startup

作者: 李留白 | 来源:发表于2021-09-03 18:30 被阅读0次
    [PM2] Init System found: systemd
    Platform systemd
    Template
    [Unit]
    Description=PM2 process manager
    Documentation=https://pm2.keymetrics.io/
    After=network.target
    
    [Service]
    Type=forking
    User=root
    LimitNOFILE=infinity
    LimitNPROC=infinity
    LimitCORE=infinity
    Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
    Environment=PM2_HOME=/root/.pm2
    PIDFile=/root/.pm2/pm2.pid
    Restart=on-failure
    
    ExecStart=/usr/local/lib/node_modules/pm2/bin/pm2 resurrect
    ExecReload=/usr/local/lib/node_modules/pm2/bin/pm2 reload all
    ExecStop=/usr/local/lib/node_modules/pm2/bin/pm2 kill
    
    [Install]
    WantedBy=multi-user.target
    
    Target path
    /etc/systemd/system/pm2-root.service
    Command list
    [ 'systemctl enable pm2-root' ]
    [PM2] Writing init configuration in /etc/systemd/system/pm2-root.service
    [PM2] Making script booting at startup...
    [PM2] [-] Executing: systemctl enable pm2-root...
    Created symlink from /etc/systemd/system/multi-user.target.wants/pm2-root.service to /etc/systemd/system/pm2-root.service.
    [PM2] [v] Command successfully executed.
    +---------------------------------------+
    [PM2] Freeze a process list on reboot via:
    $ pm2 save
    
    [PM2] Remove init script via:
    $ pm2 unstartup systemd
    
    
    
    root@:~# pm2 list
    ┌─────┬───────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
    │ id  │ name      │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
    └─────┴───────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
    [PM2][WARN] Current process list is not synchronized with saved list. App main main differs. Type 'pm2 save' to synchronize.
    root@iZbp1dy584jm2j92v9wnh2Z:~# pm2 start /web-server/dist/main.js
    [PM2] Starting /web-server/dist/main.js in fork_mode (1 instance)
    [PM2] Done.
    ┌─────┬─────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
    │ id  │ name    │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
    ├─────┼─────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
    │ 0   │ main    │ default     │ 0.0.1   │ fork    │ 1453     │ 0s     │ 0    │ online    │ 0%       │ 33.9mb   │ root     │ disabled │
    └─────┴─────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
    [PM2][WARN] Current process list is not synchronized with saved list. Type 'pm2 save' to synchronize.
    root@:~# pm2 save
    [PM2] Saving current process list...
    [PM2] Successfully saved in /root/.pm2/dump.pm2
    

    相关文章

      网友评论

          本文标题:pm2 startup

          本文链接:https://www.haomeiwen.com/subject/agikwltx.html