Linux Administration
medium

Pregunta de Linux Administration #019e3987

Enunciado de la Pregunta
Linux Administration
#sighup
#killall
#daemon-reload
#signal-handling
#process-signals
Medio

Which signal is missing from the following command that is commonly used to instruct a daemon to reinitialize itself, including reading configuration files?

killall -s _______ daemon

A

SIGKILL

B

SIGTERM

C

SIGHUP

Correcto
D

SIGINT

Explicación Oficial / Explicaciones de la Comunidad

The missing signal is SIGHUP. The command killall -s SIGHUP daemon sends the SIGHUP signal to all processes named daemon. SIGHUP is commonly used to instruct a daemon to reinitialize itself, including re-reading its configuration files, without fully stopping and restarting the process. This behavior is a convention for many Unix daemons (e.g., Apache, sshd, syslogd).

How it Works

Signals are a form of interprocess communication in Unix-like systems. The killall command sends a specified signal to all processes matching a given name. The -s flag specifies the signal to send. SIGHUP (signal number 1) traditionally indicates a hang-up on a terminal, but daemons repurpose it as a "reload" or "reinitialize" directive. When a daemon receives SIGHUP, it typically closes and reopens log files, re-reads configuration files, or performs a graceful restart.

Why the Correct Value is Right

SIGHUP is the standard signal for requesting a daemon to reload its configuration. Many daemons implement a SIGHUP handler that triggers a reinitialization sequence. For example, the Apache HTTP server (httpd) re-reads its configuration on SIGHUP, and sshd re-reads its configuration as well. Using killall -s SIGHUP daemon is a common administrative task to apply configuration changes without downtime.

Why the Incorrect Values are Wrong

  • SIGKILL (signal 9) forcefully terminates a process immediately. It cannot be caught, blocked, or ignored by the process. It does not allow any cleanup or reinitialization; it simply kills the process. This is not appropriate for instructing a daemon to reinitialize.
  • SIGTERM (signal 15) is the default signal sent by kill and killall. It requests a process to terminate gracefully, allowing it to clean up resources. While some daemons might re-read configuration on SIGTERM before exiting, the standard signal for reinitialization is SIGHUP, not SIGTERM.
  • SIGINT (signal 2) is typically generated by the user pressing Ctrl+C in a terminal. It interrupts a process and usually causes it to terminate. It is not used for daemon reinitialization; it is intended for interactive processes.