You have just renamed /var/log/myapp/service.log to service.log.1 as part of a manual log-rotation procedure while the daemon that owns PID 1472 is still running. To make the process immediately close the old file descriptor and begin writing to a freshly created /var/log/myapp/service.log without stopping or killing the service, which single command should you run from the shell?
Sending the hang-up (HUP) signal with kill - either by number 1 or by name - tells most Unix/Linux daemons to behave as if their controlling terminal disappeared. Modern services repurpose this event to re-read configuration files and, crucial for log rotation, to reopen any files they have open. Therefore issuing "kill -HUP 1472" (or equivalently "kill -1 1472") causes the daemon to close and reopen its log file without terminating. SIGUSR1 is only meaningful for daemons explicitly coded to use it (for example, some syslog implementations) and is not a universal convention. SIGKILL (9) forces an unconditional exit, which would drop client connections and require a restart, while SIGCONT merely resumes a stopped process and has no effect on file descriptors. Thus, the HUP signal is the safe, portable choice in this scenario.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does the HUP signal actually do to a process?
Open an interactive chat with Bash
Why is SIGUSR1 not suitable for all daemons in this scenario?
Open an interactive chat with Bash
Why should SIGKILL not be used in place of -HUP for this task?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Services and User Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access