0

when trying to stop a nodejs process running from a service file the service is never actually stopped, and just keeps running, forcing me to manually kill the process in htop each time. any ideas on how to make the process actually stop ?

additionally i apologize if this isn't the right place to ask this :(

using this as a service file:

[Unit]
Description=Next.JS enviro
After=network.target

[Service]
User=user
Group=group
Type=simple
KillMode=process
WorkingDirectory=/var/www/website.com
ExecStart=/bin/bash -c "npx next start -p 5050"
Restart=on-failure
RestartSec=3

[Install]
WantedBy=multi-user.target
3
  • Did you get any error when you stop the service? You can check more logs about your service by using: sudo journalctl -xeu yourfile.service (or sudo journalctl -xu yourfile.service to see logs from the beginning) Commented Jan 3, 2023 at 23:55
  • @EdgarMagallon noo, no errors, however it does say stuff about the stop job has finished, and the service entering into a dead state, however the node process is still live :[ Commented Jan 4, 2023 at 0:50
  • Try changing KillMode=process to KillMode=control-group (fromman systemd.kill both KillMode=process and KillMode=none are not recommended) Commented Jan 4, 2023 at 1:02

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.