diff --git a/icinga-x509.service b/icinga-x509.service index aac5f2b9b204c9aad4abd842fd4a825a09a034ee..e76115f5219584a9666daeb26be39a9774bdcffa 100644 --- a/icinga-x509.service +++ b/icinga-x509.service @@ -3,7 +3,7 @@ Description=Icinga Certificate Monitoring Module Jobs Runner [Service] Type=simple -User=icingaweb2 +User=apache ExecStart=/usr/bin/icingacli x509 jobs run Restart=on-success diff --git a/icingaweb2-module-x509.spec b/icingaweb2-module-x509.spec index fd55237fbaed12b181260876bd9ef247930ba089..03b7fb15862c53cd738c5208eeb28b199cffe8eb 100644 --- a/icingaweb2-module-x509.spec +++ b/icingaweb2-module-x509.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 @@ -58,6 +64,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}