tractor.dev/toolkit-go@v0.0.0-20241010005851-214d91207d07/engine/daemon/daemon_linux.go (about)

     1  package daemon
     2  
     3  import (
     4  	"os"
     5  	"os/signal"
     6  	"syscall"
     7  )
     8  
     9  // TerminateOnSignal waits for SIGINT, SIGHUP, SIGTERM, SIGKILL(?) to terminate the daemon.
    10  func TerminateOnSignal(d *Framework) {
    11  	termSigs := make(chan os.Signal, 1)
    12  	signal.Notify(termSigs, os.Interrupt, os.Kill, syscall.SIGHUP, syscall.SIGTERM)
    13  	<-termSigs
    14  	d.Terminate()
    15  }