diff options
Diffstat (limited to 'src/monitor')
-rw-r--r-- | src/monitor/monitor.c | 13 | ||||
-rw-r--r-- | src/monitor/monitor_interfaces.h | 3 | ||||
-rw-r--r-- | src/monitor/monitor_sbus.c | 13 |
3 files changed, 26 insertions, 3 deletions
diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c index 0f9fb95e..56a74fba 100644 --- a/src/monitor/monitor.c +++ b/src/monitor/monitor.c @@ -742,6 +742,10 @@ static int service_signal_offline(struct mt_svc *svc) { return service_signal(svc, MON_CLI_METHOD_OFFLINE); } +static int service_signal_rotate(struct mt_svc *svc) +{ + return service_signal(svc, MON_CLI_METHOD_ROTATE); +} static int check_domain_ranges(struct sss_domain_info *domains) { @@ -1103,11 +1107,14 @@ static void monitor_hup(struct tevent_context *ev, void *private_data) { struct mt_ctx *ctx = talloc_get_type(private_data, struct mt_ctx); + struct mt_svc *cur_svc; DEBUG(1, ("Received SIGHUP.\n")); - /* Right now this function doesn't do anything. - * It will handle logrotate HUPs soon. - */ + + /* Signal all services to rotate debug files */ + for(cur_svc = ctx->svc_list; cur_svc; cur_svc = cur_svc->next) { + service_signal_rotate(cur_svc); + } } static int monitor_cleanup(void) diff --git a/src/monitor/monitor_interfaces.h b/src/monitor/monitor_interfaces.h index 205b072e..8e334ab7 100644 --- a/src/monitor/monitor_interfaces.h +++ b/src/monitor/monitor_interfaces.h @@ -41,6 +41,7 @@ #define MON_CLI_METHOD_SHUTDOWN "shutDown" #define MON_CLI_METHOD_RES_INIT "resInit" #define MON_CLI_METHOD_OFFLINE "goOffline" /* Applicable only to providers */ +#define MON_CLI_METHOD_ROTATE "rotateLogs" #define SSSD_SERVICE_PIPE "private/sbus-monitor" @@ -51,4 +52,6 @@ int monitor_common_pong(DBusMessage *message, struct sbus_connection *conn); int monitor_common_res_init(DBusMessage *message, struct sbus_connection *conn); +int monitor_common_rotate_logs(DBusMessage *message, + struct sbus_connection *conn); diff --git a/src/monitor/monitor_sbus.c b/src/monitor/monitor_sbus.c index 3f73e84f..d60a087e 100644 --- a/src/monitor/monitor_sbus.c +++ b/src/monitor/monitor_sbus.c @@ -193,3 +193,16 @@ int monitor_common_res_init(DBusMessage *message, return monitor_common_pong(message, conn); } +int monitor_common_rotate_logs(DBusMessage *message, + struct sbus_connection *conn) +{ + int ret; + + ret = rotate_debug_files(); + if (ret) { + DEBUG(1, ("Could not rotate debug files!\n")); + return ret; + } + + return monitor_common_pong(message, conn); +} |