Пытаюсь настроить демона для запуска скрипта run start.
Использую ubuntu 22.
В общем путь к package.json /var/www/microservices/microOne.
Я создал файл тут /etc/systemd/system/myapp.script со следующим содержимым:
[Unit]
Description=MicroOne Service
After=network.target
[Service]
Type=simple
WorkingDirectory=/var/www/microservices/microOne
ExecStart=/root/.nvm/versions/node/v20.11.0/bin/npm run start
Restart=always
RestartSec=3
StandardOutput=syslog
StandardError=syslog
[Install]
WantedBy=multi-user.target
После ввел команду
sudo systemctl daemon-reload
Далее
sudo systemctl start myapp
Включаю автозапуск
sudo systemctl enable myapp
Проверяю статус и ничего не работает. Не пойму почему пути все верные
root@microservice-1st:/etc/systemd/system# sudo systemctl status myapp
× myapp.service - My Application
Loaded: loaded (/etc/systemd/system/myapp.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2024-02-16 14:55:48 UTC; 2min 55s ago
Main PID: 1648 (code=exited, status=203/EXEC)
CPU: 1ms
Feb 16 14:55:48 microservice-1st systemd[1]: myapp.service: Scheduled restart job, restart counter is at 5.
Feb 16 14:55:48 microservice-1st systemd[1]: Stopped My Application.
Feb 16 14:55:48 microservice-1st systemd[1]: myapp.service: Start request repeated too quickly.
Feb 16 14:55:48 microservice-1st systemd[1]: myapp.service: Failed with result 'exit-code'.
Feb 16 14:55:48 microservice-1st systemd[1]: Failed to start My Application.