Disponible

amalgame-service

SIGTERM / SIGINT + Windows SCM dispatcher.

amc package add service GitHub ↗ ← Retour à l'écosystème

Vue d'ensemble

Intégration daemon/service cross-OS. Sous Linux/macOS : gestion propre des signaux SIGTERM et SIGINT pour shutdown gracieux. Sous Windows : le binaire est un vrai service (dispatcher SCM natif), enregistré avec sc.exe, sans NSSM ni wrapper tiers.

Caractéristiques

  • ✓SIGTERM / SIGINT handlers cross-OS
  • ✓Windows Service Control Manager natif (depuis v0.2)
  • ✓amc new --template service fournit l'unité systemd et le plist launchd
  • ✓Le même modèle fournit les scripts d'installation install.sh, install-macos.sh et install.ps1
  • ✓Service.Sleep(ms) rend la main dès l'arrêt ; Service.RequestStop() arrête depuis le programme

Exemple

Exemple minimal d'utilisation — recopiable tel quel après l'install.

amc package add service

import Amalgame.Service

class Program {
    public static int Main(List<string> args) {
        Service.RunAsService("my-app")   // SIGTERM / SIGINT ; sous Windows, le SCM aussi
        while (!Service.ShouldStop()) {
            Console.WriteLine("working")
            Service.Sleep(5000)          // rend la main dès l'arrêt
        }
        Console.WriteLine("clean shutdown")
        return 0
    }
}

En bref

Packages liés