File use_sudo_systemctl_for_restart.patch of Package repmgr
Index: repmgr-5.2.0/repmgr.conf.sample
===================================================================
--- repmgr-5.2.0.orig/repmgr.conf.sample
+++ repmgr-5.2.0/repmgr.conf.sample
@@ -408,6 +408,10 @@ ssh_options='-q -o ConnectTimeout=10' #
# "pg_ctlcluster". *IMPORTANT*: it is *not* a substitute
# for "promote_command"; do not use "repmgr standby promote"
# (or a script which executes "repmgr standby promote") here.
+service_start_command = '/usr/bin/sudo /usr/bin/systemctl start postgresql'
+service_stop_command = '/usr/bin/sudo /usr/bin/systemctl stop postgresql'
+service_restart_command = '/usr/bin/sudo /usr/bin/systemctl restart postgresql'
+service_reload_command = '/usr/bin/sudo /usr/bin/systemctl reload postgresql'
# Used by "repmgr service (start|stop)" to control repmgrd
#