"systemctl start pm2-user-name" выдает ОШИБКУ - PullRequest
0 голосов
/ 09 июля 2019

Я настраиваю новый сервер и сейчас пытаюсь установить pm2 и работаю, следуя этой инструкции https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-18-04

При попытке sudo systemctl start pm2-userName я получаю это сообщение об ошибке: «Задание для pm2-userName.service не выполнено, поскольку служба не предприняла шаги, требуемые для конфигурации его модуля.»

Любая помощь будет очень признательна, так как я застрял на этом. Спасибо! "

Я следовал этим шагам до сих пор: - sudo npm install pm2@latest -g // (установлен отлично!) - pm2 start hello.js // (работает отлично!) - pm2 startup systemd // (я получаю suth env PATH ... для копирования пасты) - copyPasted sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u carles --hp /home/carles // (и все выглядит по-прежнему нормально и работает (см. ниже сценарий запуска) - sudo pm2 save (работал) - s udo systemctl start pm2-carles (FAILED! as Задание для pm2-carles.service не удалось, поскольку служба не предприняла шаги, требуемые конфигурацией его модуля.) - systemctl status pm2-carles.service // (загружено, но активно: не удалось (результат: протокол)

НАЧАЛЬНЫЙ СКРИПТ /// ##########################

[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)"
...