Nächste: , Vorige: , Nach oben: Persönliche Dienste   [Inhalt][Index]


13.3.5 Benutzer-Daemons verwalten

Das Modul (gnu home services shepherd) ermöglicht die Definition von Shepherd-Diensten für jeden Nutzer (siehe Introduction in Handbuch von GNU Shepherd). Dazu erweitern Sie home-shepherd-service-type mit neuen Diensten. Guix Home kümmert sich dann darum, dass der shepherd-Daemon für Sie beim Anmelden gestartet wird, und er startet wiederum die Dienste, die Sie anfordern.

Variable: home-shepherd-service-type

Der Diensttyp für das als normaler Benutzer ausgeführte Shepherd, womit man sowohl durchgängig laufende Prozesse als auch einmalig ausgeführte Aufgaben verwalten. Mit Benutzerrechten ausgeführte Shepherd-Prozesse sind keine „init“-Prozesse (PID 1), aber ansonsten sind fast alle Informationen aus Shepherd-Dienste auch für sie anwendbar.

Dieser Diensttyp stellt das Ziel für Diensterweiterungen dar, die Shepherd-Dienste erzeugen sollen (siehe Diensttypen und Dienste für ein Beispiel). Jede Erweiterung muss eine Liste von <shepherd-service>-Objekten übergeben. Sein Wert muss eine home-shepherd-configuration sein, wie im Folgenden beschrieben.

Datentyp: home-shepherd-configuration

Dieser Datentyp repräsentiert die Konfiguration von Shepherd.

shepherd (Vorgabe: shepherd)

Das zu benutzende Shepherd-Paket.

auto-start? (Vorgabe: #t)

Ob Shepherd bei einer ersten Anmeldung gestartet werden soll.

daemonize? (default: #t)

Whether or not to run Shepherd in the background.

silent? (default: #t)

When true, the shepherd process does not write anything to standard output when started automatically.

services (Vorgabe: '())

Eine Liste zu startender Shepherd-Dienste als <shepherd-service>-Objekte. Wahrscheinlich sollten Sie stattdessen den Mechanismus zur Diensterweiterung benutzen (siehe Shepherd-Dienste).

The Shepherd allows you to define timers, a special type of service that performs a given task periodically. Just like you can define timers at the system level (siehe Geplante Auftragsausführung), you can do so in your home environment.

The example below defines a home environment where a Shepherd timer runs the mkid command twice per day (siehe mkid invocation in ID Database Utilities). It does so by extending home-shepherd-service-type with simple-service; the Shepherd timer itself is produced by the shepherd-timer procedure (siehe shepherd-timer), which is given the service name, a gexp specifying its schedule, and a gexp specifying the command to run.

(use-modules (gnu) (guix)
             (gnu home services shepherd)
             (gnu packages idutils))

(define idutils-service
  ;; Index my 'doc' directory everyday at 12:15PM and 7:15PM.
  (simple-service
   'update-idutils-database home-shepherd-service-type
   (list (shepherd-timer '(update-idutils-database)
                         #~(calendar-event #:hours '(12 19)
                                           #:minutes '(15))
                         #~(#$(file-append idutils "/bin/mkid")
                            "doc")))))

(home-environment
  ;; …
  (services (append (list idutils-service)
                    %base-home-services)))

Siehe Timers in The GNU Shepherd Manual for more information on Shepherd timers.

The Shepherd also comes with a log rotation service, which compresses and then deletes old log files produced by services and daemons that it runs. This service is made available through home-log-rotation-service-type as described below.

Variable: home-log-rotation-service-type

This is the service type for the user Shepherd log rotation service (siehe Log Rotation Service in The GNU Shepherd Manual). Its value must be a log-rotation-configuration record, exactly as for its system-wide counterpart. Siehe log-rotation-configuration, for its reference.

This service is part of %base-home-services.

Variable: home-shepherd-transient-service-type
Variable: home-shepherd-timer-service-type

These are the timer and transient Shepherd services. The former lets you schedule command execution for later, while the latter can run commands in the background as a regular service.

Siehe the system timer and transient services, which are their Guix System counterparts, for more info.


Nächste: Secure Shell, Vorige: Persönliche Dienste zur Stromverbrauchsverwaltung, Nach oben: Persönliche Dienste   [Inhalt][Index]