Score:0

Systemd shows inactive dead without errors

um flag

I'm trying to config a service on Ubuntu 18.04 but the result is inactive (dead). This is my service file:

[Unit]
Description=asdfondi website
Documentation=https://github.com/riccardi1997/asdfondi
After=network.target

[Service]
Environment=HOST=[hostname] DATABASE_URL=[database-url]
Type=simple
User=salr
ExecStart=/home/salr/.nvm/versions/node/v16.18.1/bin/node /home/salr/asdfondi/s$
Restart=on-failure

[Install]
WantedBy=multi-user.target

This is the guide I'm following: https://nodesource.com/blog/running-your-node-js-app-with-systemd-part-1/

And this is the result of sudo systemctl status [service-name]:

● asdfondi.service - asdfondi website
   Loaded: loaded (/lib/systemd/system/asdfondi.service; enabled; vendor preset:
   Active: inactive (dead) since Sun 2022-11-27 08:28:14 CET; 13min ago
     Docs: https://github.com/riccardi1997/asdfondi
 Main PID: 10360 (code=exited, status=0/SUCCESS)

Nov 27 08:28:13 asdfondicalci systemd[1]: Started asdfondi website.

I'm blocked, for me everything is ok. Where am I wrong?

Sorry for the duplicated question, but the others are not helping me.

PonJar avatar
in flag
Your output shows systemd running the app/service successfully and completing what ever the task was. That suggests there is nothing in the task to continue doing such as listening on a port and processing any input. What happens if you take the command in the Execstart line and run it on the command line?
Salvatore Riccardi avatar
um flag
@PonJar it doesn't start because the exec cmd need environment variables but I declare them in service. So if the service start and export the environment variables I can also use them and start the exec cmd, right?
Salvatore Riccardi avatar
um flag
Sorry, it was my fault. I have to run npm start not the exec cmd above. Now the service is active (running)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.