From 76acef5648a00664a796a82b52593f5a12203d90 Mon Sep 17 00:00:00 2001 From: Markus Frosch Date: Mon, 9 Sep 2019 14:38:24 +0200 Subject: [PATCH] Use correct username for service --- icinga-director.service | 2 +- icingaweb2-module-director.spec | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/icinga-director.service b/icinga-director.service index eba815b..13d89a9 100644 --- a/icinga-director.service +++ b/icinga-director.service @@ -3,7 +3,7 @@ Description=Icinga Director Job runner [Service] Type=simple -User=icingaweb2 +User=apache ExecStart=/usr/bin/icingacli director jobs run --forever Restart=on-success diff --git a/icingaweb2-module-director.spec b/icingaweb2-module-director.spec index 53443d9..b90d47e 100644 --- a/icingaweb2-module-director.spec +++ b/icingaweb2-module-director.spec @@ -21,6 +21,12 @@ BuildArch: noarch %global basedir %{_datadir}/icingaweb2/modules/%{module_name} %global service_name icinga-%{module_name} +%if "%{_vendor}" == "suse" +%global service_user wwwrun +%else # suse +%global service_user apache +%endif # suse + BuildRequires: systemd-devel Requires: systemd @@ -51,6 +57,9 @@ cp -r * %{buildroot}%{basedir} install -d %{buildroot}%{_unitdir} install -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{service_name}.service +# Replace user in service unit +sed -i -e 's~^User=.*~User=%{service_user}~' %{buildroot}%{_unitdir}/%{service_name}.service + %if "%{_vendor}" == "suse" install -d %{buildroot}%{_sbindir} ln -sf /usr/sbin/service %{buildroot}%{_sbindir}/rc%{service_name}