10

What signal will upstart/initctl use to restart a job? Furthermore, is there any way to specify that SIGHUP should be used?

Alternately, is there a way to define a custom reload command that will send a SIGHUP? Or do I need to go outside of upstart to do that?

2
  • I believe it's SIGQUIT; The response to SIGHUP is application specific in most cases.
    – Chris S
    Oct 11, 2010 at 16:10
  • That would make sense. See my clarification edits.
    – David Eyk
    Oct 11, 2010 at 16:14

1 Answer 1

23

What signal will upstart/initctl use to restart a job?

SIGTERM

$ strace -fp `pgrep cron` 2> ~/strace &
$ initctl restart cron
$ cat ~/strace
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGCHLD, NULL, {0x804a280, [CHLD], SA_RESTART}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
nanosleep({60, 0}, {57, 153662204})     = ? ERESTART_RESTARTBLOCK (To be restarted)
--- SIGTERM (Terminated) @ 0 (0) ---
Process 2275 detached

Furthermore, is there any way to specify that SIGHUP should be used?

Use: initctl reload

Alternately, is there a way to define a custom reload command that will send a SIGHUP?

Use: initctl reload

Or do I need to go outside of upstart to do that?

Use initctl reload or kill/killall -HUP

2
  • Very thorough. Thank you. Guess I could have found some of that on the man page!
    – David Eyk
    Oct 11, 2010 at 16:32
  • It's upgraded to a SIGKILL if the service doesn't stop in time. "Stopping a job involves sending SIGTERM to it. ... However, if the service takes more than kill timeout seconds (default, 5 seconds) then it will be sent SIGKILL" upstart.ubuntu.com/cookbook/#pre-stop
    – scipilot
    Aug 11, 2017 at 0:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .