1

I read a lot about systemd recently but i can't figure it out how to run my mono-service via systemd.

Below is my current systemd daemon configuration:

root@LNXOSESTNL:/opt/omnius-statusdaemon# cat /etc/systemd/system/omnius-statusdaemon.service 
[Unit]
Description="Omnius StatusDaemon"
After=network.target

[Service]
Type=simple
User=omnius-statusdaemon
Group=omnius-statusdaemon
ExecStart=/usr/bin/mono-service -d:/opt/omnius-statusdaemon /opt/omnius-statusdaemon/Dynacommerce.StatusQueueService.exe
PIDFile=/tmp/omnius-statusdaemon.pid
StandardOutput=journal+console

[Install]
WantedBy=default.target

When i run above exec script directly all is working fine and my mono-service is running. However via systemd the output is below:

root@LNXOSESTNL:/opt/omnius-statusdaemon# systemctl status omnius-statusdaemon.service
● omnius-statusdaemon.service - "Omnius StatusDaemon"
   Loaded: loaded (/etc/systemd/system/omnius-statusdaemon.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Sat 2018-03-17 11:26:38 CET; 2s ago
  Process: 11099 ExecStart=/usr/bin/mono-service -d:/opt/omnius-statusdaemon /opt/omnius-statusdaemon/Dynacommerce.StatusQueueService.exe (code=exited, status=0/SUCCESS)
 Main PID: 11099 (code=exited, status=0/SUCCESS)

Mar 17 11:26:38 LNXOSESTNL systemd[1]: Started "Omnius StatusDaemon".

Hope that someone can help me guide to the right direction.

7
  • Put your PIDFile to /var/run/, I think it could help. Mar 17, 2018 at 10:29
  • @AlexanderTolkachev tried that too before but it doesnt make any diff. Put it in /tmp to ensure that there is atleast no permission issue at all for now
    – Dirkos
    Mar 17, 2018 at 10:41
  • Ok, so PIDFile exist and contains actual PID? Mar 17, 2018 at 11:03
  • @AlexanderTolkachev no PID file created
    – Dirkos
    Mar 17, 2018 at 11:47
  • So that's why systemd think that service dead. Mar 17, 2018 at 11:50

1 Answer 1

0

SystemD think that service dead because there is no PID file on expected path. This pid file should be created by your service, systemd just check, it not create this file. If you don't want create this file in your service, may be you could create it with small shell script in section ExecStartPost=.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .