Use correct username for service

This commit is contained in:
Markus Frosch 2019-09-09 14:38:24 +02:00
parent 20507dae4a
commit 197d3da1ca
2 changed files with 10 additions and 1 deletions

View File

@ -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

View File

@ -25,6 +25,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
@ -59,6 +65,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}