dotnet add package Microsoft.Extensions.Hosting.Systemd
Program.cs
var builder = WebApplication.CreateBuilder(args); builder.Host.UseSystemd();
The systemd service file must be configured with Type=notify
to enable notifications
References
https://stackoverflow.com/questions/71233335/use-systemd-on-asp-net-core-6-0