k m
k m

Reputation: 95

How to manage kestrel service that is stopped

I publish my AspNetCore project in CentOs7 x64 on kestrel without any reverse proxy server like enginx webServer.

My service stopped sometimes, how can I reset crashed service named kestrel?

I create kestrel service in /etc/systemd/system with this bash script:

[Unit]
Description=TestProject running on CentOS 7

[Service]
WorkingDirectory=/home/aspnetcore/TestProject
ExecStart=/usr/bin/dotnet /home/aspnetcore/TestProject/WebUi.dll
Restart=always
# Restart service after 10 seconds if dotnet service crashes
RestartSec=10
SyslogIdentifier=dotnet-example
User=root
Environment=ASPNETCORE_ENVIRONMENT=Production

[Install]
WantedBy=multi-user.target 

Upvotes: 2

Views: 619

Answers (1)

hamid_reza hobab
hamid_reza hobab

Reputation: 929

you can use Monitoring systems for manage service lifetime.

Zabbix, PRTG and ManageEngine is best monitoring system. usually i use ManageEngine monitoring, that has Events as a sensor of service status. and for each event you can set Action(s), like execute bash script (for reset kestrel service).

Upvotes: 1

Related Questions