• nous@programming.dev
    link
    fedilink
    English
    arrow-up
    7
    ·
    2 days ago

    SIGINT is sent when you press Ctrl+C. SIGTERM is sent in just about every other situation - basically when the system wants the program to end. For instance when systemd wants to stop the service or the default signal with programs like kill pkill htop etc. You should catch both of these signals.

    • bleistift2OP
      link
      fedilink
      arrow-up
      2
      ·
      2 days ago

      I did try to catch all of these signals:

                      | "SIGABRT"
                      | "SIGALRM"
                      | "SIGBUS"
                      | "SIGCHLD"
                      | "SIGCONT"
                      | "SIGFPE"
                      | "SIGHUP"
                      | "SIGILL"
                      | "SIGINT"
                      | "SIGIO"
                      | "SIGIOT"
                      | "SIGKILL"
                      | "SIGPIPE"
                      | "SIGPOLL"
                      | "SIGPROF"
                      | "SIGPWR"
                      | "SIGQUIT"
                      | "SIGSEGV"
                      | "SIGSTKFLT"
                      | "SIGSTOP"
                      | "SIGSYS"
                      | "SIGTERM"
                      | "SIGTRAP"
                      | "SIGTSTP"
                      | "SIGTTIN"
                      | "SIGTTOU"
                      | "SIGUNUSED"
                      | "SIGURG"
                      | "SIGUSR1"
                      | "SIGUSR2"
                      | "SIGVTALRM"
                      | "SIGWINCH"
                      | "SIGXCPU"
                      | "SIGXFSZ"
                      | "SIGBREAK"
                      | "SIGLOST"
                      | "SIGINFO";