当前位置: 首页 > 知识库问答 >
问题:

“SystemCTL start PM2-user-name”出错

张光辉
2023-03-14

启动脚本///########################

[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=carles
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:/usr/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
Environment=PM2_HOME=/home/carles/.pm2
PIDFile=/home/carles/.pm2/pm2.pid
Restart=on-failure

ExecStart=/usr/lib/node_modules/pm2/bin/pm2 resurrect
ExecReload=/usr/lib/node_modules/pm2/bin/pm2 reload all
ExecStop=/usr/lib/node_modules/pm2/bin/pm2 kill

[Install]
WantedBy=multi-user.target

Target path
/etc/systemd/system/pm2-carles.service
Command list
[ 'systemctl enable pm2-carles' ]
[PM2] Writing init configuration in /etc/systemd/system/pm2-carles.service
[PM2] Making script booting at startup...
[PM2] [-] Executing: systemctl enable pm2-carles...
[PM2] [v] Command successfully executed.
+---------------------------------------+
[PM2] Freeze a process list on reboot via:
$ pm2 save

[PM2] Remove init script via:
$ pm2 unstartup systemd

JOURNALCTL-xe#############################################

Hint: You are currently not seeing messages from other users and the system.
      Users in groups 'adm', 'systemd-journal' can see all messages.
      Pass -q to turn off this notice.
Jul 09 09:36:19 future-card pm2[4752]: [PM2] Resurrecting
Jul 09 09:36:19 future-card pm2[4752]: [PM2] Restoring processes located in /home/carles/.pm2/dump.pm2
Jul 09 09:36:19 future-card pm2[4752]: ┌──────────┬────┬─────────┬──────┬──────┬────────┬─────────┬────────┬──
Jul 09 09:36:19 future-card pm2[4752]: │ App name │ id │ version │ mode │ pid  │ status │ restart │ uptime │ c
Jul 09 09:36:19 future-card pm2[4752]: ├──────────┼────┼─────────┼──────┼──────┼────────┼─────────┼────────┼──
Jul 09 09:36:19 future-card pm2[4752]: │ hello    │ 0  │ N/A     │ fork │ 3268 │ online │ 0       │ 33m    │ 0
Jul 09 09:36:19 future-card pm2[4752]: └──────────┴────┴─────────┴──────┴──────┴────────┴─────────┴────────┴──
Jul 09 09:36:19 future-card pm2[4752]:  Use `pm2 show <id|name>` to get more details about an app
Jul 09 09:36:20 future-card pm2[4783]: [PM2] Resurrecting
Jul 09 09:36:20 future-card pm2[4783]: [PM2] Restoring processes located in /home/carles/.pm2/dump.pm2
Jul 09 09:36:20 future-card pm2[4783]: ┌──────────┬────┬─────────┬──────┬──────┬────────┬─────────┬────────┬──
Jul 09 09:36:20 future-card pm2[4783]: │ App name │ id │ version │ mode │ pid  │ status │ restart │ uptime │ c
Jul 09 09:36:20 future-card pm2[4783]: ├──────────┼────┼─────────┼──────┼──────┼────────┼─────────┼────────┼──
Jul 09 09:36:20 future-card pm2[4783]: │ hello    │ 0  │ N/A     │ fork │ 3268 │ online │ 0       │ 33m    │ 0
Jul 09 09:36:20 future-card pm2[4783]: └──────────┴────┴─────────┴──────┴──────┴────────┴─────────┴────────┴──
Jul 09 09:36:20 future-card pm2[4783]:  Use `pm2 show <id|name>` to get more details about an app
Jul 09 09:36:20 future-card pm2[4815]: [PM2] Resurrecting
Jul 09 09:36:20 future-card pm2[4815]: [PM2] Restoring processes located in /home/carles/.pm2/dump.pm2
Jul 09 09:36:20 future-card pm2[4815]: ┌──────────┬────┬─────────┬──────┬──────┬────────┬─────────┬────────┬──
Jul 09 09:36:20 future-card pm2[4815]: │ App name │ id │ version │ mode │ pid  │ status │ restart │ uptime │ c
Jul 09 09:36:20 future-card pm2[4815]: ├──────────┼────┼─────────┼──────┼──────┼────────┼─────────┼────────┼──
Jul 09 09:36:20 future-card pm2[4815]: │ hello    │ 0  │ N/A     │ fork │ 3268 │ online │ 0       │ 33m    │ 0
Jul 09 09:36:20 future-card pm2[4815]: └──────────┴────┴─────────┴──────┴──────┴────────┴─────────┴────────┴──
Jul 09 09:36:20 future-card pm2[4815]:  Use `pm2 show <id|name>` to get more details about an app
Jul 09 09:36:21 future-card pm2[4846]: [PM2] Resurrecting
Jul 09 09:36:21 future-card pm2[4846]: [PM2] Restoring processes located in /home/carles/.pm2/dump.pm2
Jul 09 09:36:21 future-card pm2[4846]: ┌──────────┬────┬─────────┬──────┬──────┬────────┬─────────┬────────┬──
Jul 09 09:36:21 future-card pm2[4846]: │ App name │ id │ version │ mode │ pid  │ status │ restart │ uptime │ c
Jul 09 09:36:21 future-card pm2[4846]: ├──────────┼────┼─────────┼──────┼──────┼────────┼─────────┼────────┼──
Jul 09 09:36:21 future-card pm2[4846]: │ hello    │ 0  │ N/A     │ fork │ 3268 │ online │ 0       │ 33m    │ 0
Jul 09 09:36:21 future-card pm2[4846]: └──────────┴────┴─────────┴──────┴──────┴────────┴─────────┴────────┴──
Jul 09 09:36:21 future-card pm2[4846]:  Use `pm2 show <id|name>` to get more details about an app
Jul 09 09:50:20 future-card pm2[5168]: [PM2] Resurrecting
Jul 09 09:50:20 future-card pm2[5168]: [PM2] Restoring processes located in /home/carles/.pm2/dump.pm2
Jul 09 09:50:20 future-card pm2[5168]: ┌──────────┬────┬─────────┬──────┬──────┬────────┬─────────┬────────┬──
Jul 09 09:50:20 future-card pm2[5168]: │ App name │ id │ version │ mode │ pid  │ status │ restart │ uptime │ c
Jul 09 09:50:20 future-card pm2[5168]: ├──────────┼────┼─────────┼──────┼──────┼────────┼─────────┼────────┼──
Jul 09 09:50:20 future-card pm2[5168]: │ hello    │ 0  │ N/A     │ fork │ 3268 │ online │ 0       │ 47m    │ 0
Jul 09 09:50:20 future-card pm2[5168]: └──────────┴────┴─────────┴──────┴──────┴────────┴─────────┴────────┴──
Jul 09 09:50:20 future-card pm2[5168]:  Use `pm2 show <id|name>` to get more details about an app
Jul 09 09:50:20 future-card pm2[5200]: [PM2] Resurrecting
Jul 09 09:50:20 future-card pm2[5200]: [PM2] Restoring processes located in /home/carles/.pm2/dump.pm2
Jul 09 09:50:20 future-card pm2[5200]: ┌──────────┬────┬─────────┬──────┬──────┬────────┬─────────┬────────┬──
Jul 09 09:50:20 future-card pm2[5200]: │ App name │ id │ version │ mode │ pid  │ status │ restart │ uptime │ c
Jul 09 09:50:20 future-card pm2[5200]: ├──────────┼────┼─────────┼──────┼──────┼────────┼─────────┼────────┼──
Jul 09 09:50:20 future-card pm2[5200]: │ hello    │ 0  │ N/A     │ fork │ 3268 │ online │ 0       │ 47m    │ 0
Jul 09 09:50:20 future-card pm2[5200]: └──────────┴────┴─────────┴──────┴──────┴────────┴─────────┴────────┴──
Jul 09 09:50:20 future-card pm2[5200]:  Use `pm2 show <id|name>` to get more details about an app
Jul 09 09:50:21 future-card pm2[5233]: [PM2] Resurrecting
Jul 09 09:50:21 future-card pm2[5233]: [PM2] Restoring processes located in /home/carles/.pm2/dump.pm2
Jul 09 09:50:21 future-card pm2[5233]: ┌──────────┬────┬─────────┬──────┬──────┬────────┬─────────┬────────┬──
Jul 09 09:50:21 future-card pm2[5233]: │ App name │ id │ version │ mode │ pid  │ status │ restart │ uptime │ c
Jul 09 09:50:21 future-card pm2[5233]: ├──────────┼────┼─────────┼──────┼──────┼────────┼─────────┼────────┼──
Jul 09 09:50:21 future-card pm2[5233]: │ hello    │ 0  │ N/A     │ fork │ 3268 │ online │ 0       │ 47m    │ 0
Jul 09 09:50:21 future-card pm2[5233]: └──────────┴────┴─────────┴──────┴──────┴────────┴─────────┴────────┴──
Jul 09 09:50:21 future-card pm2[5233]:  Use `pm2 show <id|name>` to get more details about an app
Jul 09 09:50:22 future-card pm2[5265]: [PM2] Resurrecting
Jul 09 09:50:22 future-card pm2[5265]: [PM2] Restoring processes located in /home/carles/.pm2/dump.pm2
Jul 09 09:50:22 future-card pm2[5265]: ┌──────────┬────┬─────────┬──────┬──────┬────────┬─────────┬────────┬──
Jul 09 09:50:22 future-card pm2[5265]: │ App name │ id │ version │ mode │ pid  │ status │ restart │ uptime │ c
Jul 09 09:50:22 future-card pm2[5265]: ├──────────┼────┼─────────┼──────┼──────┼────────┼─────────┼────────┼──
Jul 09 09:50:22 future-card pm2[5265]: │ hello    │ 0  │ N/A     │ fork │ 3268 │ online │ 0       │ 47m    │ 0
Jul 09 09:50:22 future-card pm2[5265]: └──────────┴────┴─────────┴──────┴──────┴────────┴─────────┴────────┴──
Jul 09 09:50:22 future-card pm2[5265]:  Use `pm2 show <id|name>` to get more details about an app
Jul 09 09:50:23 future-card pm2[5295]: [PM2] Resurrecting
Jul 09 09:50:23 future-card pm2[5295]: [PM2] Restoring processes located in /home/carles/.pm2/dump.pm2
Jul 09 09:50:23 future-card pm2[5295]: ┌──────────┬────┬─────────┬──────┬──────┬────────┬─────────┬────────┬──
Jul 09 09:50:23 future-card pm2[5295]: │ App name │ id │ version │ mode │ pid  │ status │ restart │ uptime │ c
Jul 09 09:50:23 future-card pm2[5295]: ├──────────┼────┼─────────┼──────┼──────┼────────┼─────────┼────────┼──
Jul 09 09:50:23 future-card pm2[5295]: │ hello    │ 0  │ N/A     │ fork │ 3268 │ online │ 0       │ 47m    │ 0
Jul 09 09:50:23 future-card pm2[5295]: └──────────┴────┴─────────┴──────┴──────┴────────┴─────────┴────────┴──
Jul 09 09:50:23 future-card pm2[5295]:  Use `pm2 show <id|name>` to get more details about an app```

I expect sudo systemctl start pm2-carles to run and work, instead I am getting "pm2-carles.service - PM2 process manager
   Loaded: loaded (/etc/systemd/system/pm2-carles.service; enabled; vendor preset: enabled)
   Active: failed (Result: protocol) since Tue 2019-07-09 09:50:23 UTC; 1min 2s ago
     Docs: https://pm2.keymetrics.io/
  Process: 5295 ExecStart=/usr/lib/node_modules/pm2/bin/pm2 resurrect (code=exited, status=0/SUCCESS)"

共有1个答案

农飞翔
2023-03-14

重新启动虚拟服务器对我来说很有效:

sudo reboot

如果这不起作用,请尝试:

ps aux | grep pm2 | grep -v grep | awk '{print $2}' | xargs kill -9

上面的命令杀死了pm2服务守护进程,之后您可以使用根权限重新启动它。(这是在/usr/bin/pm2目录下运行的情况下)。

 类似资料:
  • import "os/user" user包允许通过名称或ID查询用户帐户。 type UnknownUserError func (e UnknownUserError) Error() string type UnknownUserIdError func (e UnknownUserIdError) Error() string type User func Current() (*User

  • 描述 (Description) 元素选择器选择标签名称为T的所有元素。 语法 (Syntax) 以下是使用此选择器的简单语法 - $('tagname') 参数 (Parameters) 以下是此选择器使用的所有参数的说明 - tagname - 任何标准HTML标记名称,如div,p,em,img,li等。 返回值 (Returns) 与任何其他jQuery选择器一样,此选择器也返回一个填充

  • Random.first() Random.first() 随机生成一个常见的英文名。 Random.first() // => "Nancy" Random.last() Random.last() 随机生成一个常见的英文姓。 Random.last() // => "Martinez" Random.name( middle? ) Random.name() Random.name( midd

  • 描述:记录一个对象的名称。 语法 @name <namePath> 概述 @name标签强制JSDoc使用这个给定的名称,而忽略实际代码里的名称。这个标签最好用于"虚拟注释",而不是在代码中随时可见的标签,如在运行时期间产生的方法。 当您使用@name标签,你必须提供额外的标签,来告诉JSDoc什么样的标识符将被文档化;该标识符是否是另一个标识符的成员;等等。如果不提供这些信息,标识符将不会被正确

  • 说明: string Worker::$user 设置当前Worker实例以哪个用户运行。此属性只有当前用户为root时才能生效。不设置时默认以当前用户运行。 建议$user设置权限较低的用户,例如www-data、apache、nobody等。 注意:此属性必须在Worker::runAll();运行前设置才有效。windows系统不支持此特性。 范例 use WorkermanWorker;

  • WinSCP offers two program interfaces, each with extensive configuration options. During installation, you must select your preferred user interface. You may want to change your user interface preferen