- I made a .sh file to run my c# service.
- Inside sh file folder setup is
#!/bin/bash
/usr/bin/dotnet /opt/aid-dotnet/publish/IncidentDetection.dll
- And My Service file is in
/etc/systemd/system
- Name of service is sharpradar.service
[Unit]
Description=CSHARPSERVICE
[Service]
Type=forking
ExecStart= dotnet IncidentDetection.dll
WorkingDirectory=/opt/aid-dotnet/netcoreapp3.1/
Restart=on-abort
RemainAfterExit=yes
KillSignal=SIGINT
SyslogIdentifier=dotnet-example
Environment=AMQP_USERNAME=test
Environment=AMQP_PASSWORD=test123654
Environment=AMQP_HOST=192.168.2.181
Environment=AID_ID=3
Environment=ASPNETCORE_ENVIRONMENT=Development
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
[Install]
WantedBy=multi-user.target
- But when I start my service I get this message
systemctl status sharpradar.service
● cshradar.service - CSHARPSERVICE
Loaded: loaded (/etc/systemd/system/cshradar.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Wed 2023-01-25 15:57:46 IST; 1h 22min ago
Process: 20016 ExecStart=/usr/bin/dotnet IncidentDetection.dll (code=exited, status=0/SUCCESS)
Jan 25 15:56:37 aidmain-Standard-PC-i440FX-PIIX-1996 dotnet-example[20016]: 01/25/2023 15:56:37 [INF] Connected to
configuration request queue.
Jan 25 15:56:37 aidmain-Standard-PC-i440FX-PIIX-1996 dotnet-example[20016]: 01/25/2023 15:56:37 [INF] Connected to
congfiguraiton queue for AID_ID = 3.
Jan 25 15:56:37 aidmain-Standard-PC-i440FX-PIIX-1996 dotnet-example[20016]: 01/25/2023 15:56:37 [INF] Requesting
configuration for AID_ID = 3.
Jan 25 15:56:37 aidmain-Standard-PC-i440FX-PIIX-1996 dotnet-example[20016]: 01/25/2023 15:56:37 [INF] Received new
configuration.
Jan 25 15:56:37 aidmain-Standard-PC-i440FX-PIIX-1996 dotnet-example[20016]: 01/25/2023 15:56:37 [INF]
{"printReceivedData":false,"ruleConstraints":{"SpeedTooHigh":{"MaximumAllowedSpeed":15>
Jan 25 15:56:37 aidmain-Standard-PC-i440FX-PIIX-1996 dotnet-example[20016]: 01/25/2023 15:56:37 [INF] Succesfully reloaded
configuration.
Jan 25 15:56:38 aidmain-Standard-PC-i440FX-PIIX-1996 dotnet-example[20016]: 01/25/2023 15:56:38 [INF] Start waiting for
data.
Jan 25 15:56:38 aidmain-Standard-PC-i440FX-PIIX-1996 systemd[1]: Started CSHARPSERVICE.
Jan 25 15:57:46 aidmain-Standard-PC-i440FX-PIIX-1996 systemd[1]: cshradar.service: Succeeded.
Jan 25 15:57:46 aidmain-Standard-PC-i440FX-PIIX-1996 systemd[1]: Stopped CSHARPSERVICE.
- The service becomes dead when my C# service wait for data and get freeze at http request.
- But if I run this code directly inside tmux then it run properly, but not with systemd, I am unable to understand this.
- I am attaching screenshot of running example using tmux(Sorry for attacing this screenshot because its not getting formatted on stack overflow)

- I tried multiple different aspects to run but still showing dead when I use systemd.