Commit f99cbfbd authored by Apollon Oikonomopoulos's avatar Apollon Oikonomopoulos Committed by Guido Trotter
Browse files

daemon-util: provide rotate_logs and rotate_all_logs actions

Modify daemon-util to allow sending SIGHUP to one or all daemons. This is meant
as a utility function to be used in logrotate definitions.
Signed-off-by: default avatarApollon Oikonomopoulos <>
Reviewed-by: default avatarGuido Trotter <>
parent 95c83fe6
......@@ -311,6 +311,34 @@ stop_all() {
# SIGHUP a process to force re-opening its logfiles
rotate_logs() {
if [[ "$#" -lt 1 ]]; then
echo 'Missing daemon name.' >&2
return 1
local name="$1"; shift
local pidfile=$(_daemon_pidfile $name)
local daemonexec=$(_daemon_executable $name)
if type -p start-stop-daemon >/dev/null; then
start-stop-daemon --stop --signal HUP --quiet \
--pidfile $pidfile
_ignore_error killproc \
-p $pidfile \
$daemonexec -HUP
# SIGHUP all processes
rotate_all_logs() {
for i in $(list_stop_daemons); do
rotate_logs $i
# Reloads the SSH keys
reload_ssh_keys() {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment