From a122d7f4c41387ccf1144d7ce0a03d1a272b30c7 Mon Sep 17 00:00:00 2001 From: Alexis Mousset Date: Wed, 6 Nov 2019 10:35:12 +0100 Subject: [PATCH] Fixes #16128: We should not start agent daemons outside of the service --- share/commands/server-disable-policy-distribution | 15 +++++++++------ share/commands/server-enable-policy-distribution | 3 ++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/share/commands/server-disable-policy-distribution b/share/commands/server-disable-policy-distribution index e21ee11..e3515a9 100755 --- a/share/commands/server-disable-policy-distribution +++ b/share/commands/server-disable-policy-distribution @@ -8,13 +8,16 @@ # First, prevent the agent from restarting cf-serverd touch /opt/rudder/etc/disable-policy-distribution -# Then, actually stop the server right now +# Then disable and stop it +systemctl stop rudder-cf-serverd +systemctl disable rudder-cf-serverd + +# Just in case other cf-server were running if type killall > /dev/null 2> /dev/null; then - killall cf-serverd + killall cf-serverd 2> /den/null || true elif type pidof > /dev/null 2> /dev/null; then - kill $(pidof cf-serverd 2>/dev/null) + kill $(pidof cf-serverd 2>/dev/null) 2> /dev/null || true else - echo "Don't know how to stop Rudder policy server. 'killall' or 'pidof' are required." 1>&2 - echo 'Policy server not stopped!' 1>&2 - exit 2 + echo "Could not check for remaining policy server processes outside of the service" + echo "(install 'pidof' or 'killall' to enable this check)" fi diff --git a/share/commands/server-enable-policy-distribution b/share/commands/server-enable-policy-distribution index 033d432..aa45f82 100755 --- a/share/commands/server-enable-policy-distribution +++ b/share/commands/server-enable-policy-distribution @@ -10,4 +10,5 @@ rm -f /opt/rudder/etc/disable-policy-distribution # Then, actually start the server right now -/var/rudder/cfengine-community/bin/cf-serverd +systemctl enable rudder-cf-serverd +systemctl start rudder-cf-serverd