liveBook · Manning

Systemd daemon

As explained in ASP.NET Core in Action, 3e

A systemd daemon is a Linux background process managed and supervised by the systemd service manager.

A systemd daemon is a long-running .NET worker service deployed on Linux without an HTTP interface. It uses the generic IHost for configuration, logging, dependency injection, and hosted background tasks, avoiding the additional ASP.NET Core HTTP pipeline. section 34.2

Prepare a worker for systemd by adding Microsoft.Extensions.Hosting.Systemd and enabling systemd integration on IHostBuilder with the systemd extension method. The same application can remain a console app during development; service-integration packages do nothing in that mode. section 34.2.2 section 34.4

A typical systemd-hosted worker combines:

  • A BackgroundService or other IHostedService that performs repeated, scheduled, batch, or event-driven work. section 34.2
  • Generic-host configuration through IHostBuilder.ConfigureServices(), rather than the WebApplicationBuilder minimal-hosting APIs. section 34.4
  • Optional application services such as HttpClient and Entity Framework Core registered through dependency injection. section 34.2.1

Exchange-rate worker

A headless worker can periodically retrieve exchange rates and save them to a database. Other applications can then consume the stored rates without the worker exposing a user interface or handling HTTP requests. section 34.2.1 section 34.2

How ASP.NET Core in Action, 3e covers it

How deep it goes
Explains worker architecture, package integration, and host configuration, but does not detail systemd unit-file authoring or operational commands.
Examples
Uses an exchange-rate caching worker, BackgroundService templates, and database-backed hosted services as concrete examples.
What it assumes
Assumes basic .NET worker and generic-host concepts while introducing headless execution without ASP.NET Core HTTP handling.
What you can do after
Operate/configure a .NET worker for Linux systemd integration while retaining console execution for development and testing.
How it connects
Connects systemd daemons with .NET worker services, IHostBuilder, IHostedService, dependency injection, logging, configuration, and Windows Services.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.