I have simple console application, I want to run application as service in ubuntu.
I have created .service
file in /etc/systemd/system
folder HelloWorld.service
as below
[Unit]
Description=HelloWorld Application
[Service]
ExecStart=/usr/share/dotnet/dotnet /home/prasadg/HelloWorld/dev/HelloWorld.dll
SyslogIdentifier=HelloWorld
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
after I saved file I have reload daemon with command
systemctl daemon-reload
then I have started newly created service systemctl start HelloWorld
it get started and nothing happens, after sometime, when I checked status using command systemctl status HelloWorld
it shows error as below
HelloWorld.service - HelloWorld Application
Loaded: loaded (/etc/systemd/system/HelloWorld.service; disabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: core-dump) since Tue 2022-06-28 21:20:13 IST; 4s ago
Process: 28389 ExecStart=/usr/share/dotnet/dotnet /home/prasadg/HelloWorld/dev/HelloWorld.dll (code=dumped, signal=ABRT)
Main PID: 28389 (code=dumped, signal=ABRT)
if try run directly with command as /usr/share/dotnet/dotnet /home/prasadg/HelloWorld/dev/HelloWorld.dll
it runs successfully
A full log message would help more, but I guess you need to add a WorkingDirectory to your HelloWorld.service
.