0

I have developed and published a web application on dotnet core for linux arm machine. To do this, the command has been launched:

dotnet publish --runtime linux-arm -p:PublishSingleFile=true

And as a result gives the directory:

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       10/03/2020      8:56                wwwroot
-a----       09/03/2020     10:54            162 appsettings.Development.json
-a----       09/03/2020     10:54            192 appsettings.json
-a----       10/03/2020      8:56      108097487 coremonitor
-a----       09/03/2020     12:59           7248 coremonitor.pdb
-a----       10/03/2020      8:56            474 web.config

Where coremonitor is the executable. This data is sent to the server and stored in the path /root/datalogger/linux-arm/. Then we created the systemd daemon to launch it:

[Unit]
Description=Data Logger Monitor Daemon

[Service]
ExecStart=./coremonitor
WorkingDirectory=/root/dataloggermonitor/linux-arm
User=dotnetuser
Group=dotnetuser
Restart=on-failure
SyslogIdentifier=DataLoggerMonitor-Service
PrivateTmp=true

[Install]
WantedBy=multi-user.target

After restarting, I get the following systemd log (systemctl status dataloggermonitor):

● dataloggermonitor.service - Data Logger Monitor Daemon
   Loaded: error (Reason: Invalid argument)
   Active: inactive (dead)
Fco Javier Balón
  • 1,144
  • 2
  • 11
  • 31

1 Answers1

0

This is fixed by directly entering the execution path in the ExecStart parameter. The system will launch the executable from its own relative path:

[Unit]
Description=Data Logger Monitor Daemon

[Service]
ExecStart=/root/dataloggermonitor/linux-arm/coremonitor
User=dotnetuser
Group=dotnetuser
Restart=on-failure
SyslogIdentifier=DataLoggerMonitor-Service
PrivateTmp=true

[Install]
WantedBy=multi-user.target

Getting:

● dataloggermonitor.service - Data Logger Monitor Daemon
   Loaded: loaded (/etc/systemd/system/dataloggermonitor.service; enabled)
   Active: active (running) since Tue 2020-03-10 10:33:41 CET; 28s ago
 Main PID: 403 (coremonitor)
   CGroup: /system.slice/dataloggermonitor.service
           └─403 /root/dataloggermonitor/linux-arm/coremonitor

Mar 10 10:33:41 techbase systemd[1]: Starting Data Logger Monitor Daemon...
Mar 10 10:33:41 techbase systemd[1]: Started Data Logger Monitor Daemon.
Mar 10 10:34:01 techbase DataLoggerMonitor-Service[403]: Hosting environment: Production
Mar 10 10:34:01 techbase DataLoggerMonitor-Service[403]: Content root path: /var/tmp/.net/coremonitor/gcrmbwbh.wxk/
Mar 10 10:34:01 techbase DataLoggerMonitor-Service[403]: Now listening on: http://[::]:5000
Mar 10 10:34:01 techbase DataLoggerMonitor-Service[403]: Application started. Press Ctrl+C to shut down.
Fco Javier Balón
  • 1,144
  • 2
  • 11
  • 31