From 89d7d3ef75a352dbc0033e4bd49b298605fd8edb Mon Sep 17 00:00:00 2001 From: Markus Frosch <markus.frosch@icinga.com> Date: Mon, 9 Sep 2019 14:45:34 +0200 Subject: [PATCH] Use correct username for service --- icinga-reporting.service | 2 +- icingaweb2-module-reporting.spec | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/icinga-reporting.service b/icinga-reporting.service index 2890372..7a38135 100644 --- a/icinga-reporting.service +++ b/icinga-reporting.service @@ -3,7 +3,7 @@ Description=Icinga Reporting Scheduler [Service] Type=simple -User=icingaweb2 +User=apache ExecStart=/usr/bin/icingacli reporting schedule run Restart=on-success diff --git a/icingaweb2-module-reporting.spec b/icingaweb2-module-reporting.spec index 266d4c8..3c5ab7c 100644 --- a/icingaweb2-module-reporting.spec +++ b/icingaweb2-module-reporting.spec @@ -20,6 +20,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 @@ -55,6 +61,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} -- GitLab