We have a background job that is long running and cannot be idempotent. When redhat restarts our hangfire .net core app, we lose hours of progress.
We are using following configuration.
[Unit]
Description=ABC
[Service]
WorkingDirectory=/var/www/html/ABC
ExecStart=/usr/bin/dotnet /var/www/html/ABC/XYZ.DLL
Restart=always
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
[Install]
WantedBy=multi-user.target