From 4b52ed0610e399a0fe27cfab3601419acb6aff3d Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Nov 07 2018 20:38:45 +0000 Subject: MONITOR: Don't check for pidfile if SSSD is already running Related: https://pagure.io/SSSD/sssd/issue/3862 The --genconf option of sssd is meant to be used to reload configuration from a systemd socket-activated service. But it would only work if sssd was not running, which defies its purpose. Reviewed-by: Michal Židek --- diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c index 335b207..ea689c6 100644 --- a/src/monitor/monitor.c +++ b/src/monitor/monitor.c @@ -2514,13 +2514,17 @@ int main(int argc, const char *argv[]) } } - /* Check if the SSSD is already running */ - ret = check_file(SSSD_PIDFILE, 0, 0, S_IFREG|0600, 0, NULL, false); - if (ret == EOK) { - DEBUG(SSSDBG_FATAL_FAILURE, - "pidfile exists at %s\n", SSSD_PIDFILE); - ERROR("SSSD is already running\n"); - return 2; + /* Check if the SSSD is already running unless we're only interested + * in re-reading the configuration + */ + if (opt_genconf == 0) { + ret = check_file(SSSD_PIDFILE, 0, 0, S_IFREG|0600, 0, NULL, false); + if (ret == EOK) { + DEBUG(SSSDBG_FATAL_FAILURE, + "pidfile exists at %s\n", SSSD_PIDFILE); + ERROR("SSSD is already running\n"); + return 2; + } } /* Parse config file, fail if cannot be done */