Skip to content
Advertisement

RPM SPEC Systemd enable and start

I have created a RPM SPEC file but I am struggeling with Systemd enabling and starting. Updating the package through yum disables and stops the service. The distribution is Centos 7.x

I have installed the service under /etc/systemd/system. This is what I have tried so for but it does not work.

I have not found any good working examples of how to do this.

I used this page as reference. https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_systemd https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_syntax

JavaScript

Advertisement

Answer

1) the %{pkgname}.service should be placed in %{_unitdir} which expands to /usr/lib/systemd/system/

2) When you use %systemd_post %{pkgname}.service macro there is no need to have there:

JavaScript

Similary the same for %pre and %preun.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement