diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 1ce819c76a..452d665fea 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -108,8 +108,18 @@ mkdir -p /var/spool/pandora/data_out if [ ! -d /var/log/pandora ]; then mkdir -p /var/log/pandora fi -/sbin/chkconfig --add pandora_agent_daemon -/sbin/chkconfig pandora_agent_daemon on + +if [ `command -v sysctl` ]; +then + cp /usr/share/pandora_agent/pandora_agent_daemon.service /usr/lib/systemd/system/ + chmod -x /usr/lib/systemd/system/pandora_agent_daemon.service +# Enable the services on SystemD + systemctl enable pandora_agent_daemon.service +else + /sbin/chkconfig --add pandora_agent_daemon + /sbin/chkconfig pandora_agent_daemon on +fi + %preun diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 282f8a8b26..db893d7366 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -98,11 +98,20 @@ fi cp -aRf /usr/share/pandora_agent/pandora_agent_logrotate /etc/logrotate.d/pandora_agent -# Enable the service on SystemD -systemctl enable pandora_agent_daemon.service - mkdir -p /var/spool/pandora/data_out -chkconfig pandora_agent_daemon on + +if [ `command -v sysctl` ]; +then + cp /usr/share/pandora_agent/pandora_agent_daemon.service /usr/lib/systemd/system/ + chmod -x /usr/lib/systemd/system/pandora_agent_daemon.service +# Enable the services on SystemD + systemctl enable pandora_agent_daemon.service +else + chkconfig pandora_agent_daemon on +fi + + + %preun diff --git a/pandora_agents/unix/pandora_agent_daemon.service b/pandora_agents/unix/pandora_agent_daemon.service index 182144d1e7..103ca44167 100644 --- a/pandora_agents/unix/pandora_agent_daemon.service +++ b/pandora_agents/unix/pandora_agent_daemon.service @@ -4,6 +4,8 @@ After=network-online.target [Service] ExecStart=/usr/bin/pandora_agent /etc/pandora +Restart=on-failure +RestartPreventExitStatus=1 [Install] WantedBy=multi-user.target diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 22eb4fe83b..12c7517a4a 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -111,10 +111,21 @@ exit 0 %post # Initial installation if [ "$1" = 1 ]; then - /sbin/chkconfig --add pandora_server - /sbin/chkconfig --add tentacle_serverd - /sbin/chkconfig pandora_server on - /sbin/chkconfig tentacle_serverd on + if [ `command -v sysctl` ]; + then + cp /usr/share/pandora_server/util/tentacle_serverd.service /usr/lib/systemd/system/ + chmod -x /usr/lib/systemd/system/tentacle_serverd.service + # Enable the services on SystemD + systemctl enable tentacle_serverd.service + else + /sbin/chkconfig --add tentacle_serverd + /sbin/chkconfig tentacle_serverd on + fi + +/sbin/chkconfig --add pandora_server +/sbin/chkconfig pandora_server on + +systemctl enable pandora_server.service echo "Pandora FMS Server configuration is %{_sysconfdir}/pandora/pandora_server.conf" echo "Pandora FMS Server main directory is %{prefix}/pandora_server/" diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 27ae9cdd32..1ccb37ecbc 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -102,11 +102,20 @@ fi exit 0 %post -chkconfig pandora_server on -chkconfig tentacle_serverd on +if [ `command -v sysctl` ]; +then + cp /usr/share/pandora_server/util/tentacle_serverd.service /usr/lib/systemd/system/ + chmod -x /usr/lib/systemd/system/tentacle_serverd.service -# Enable the services on SystemD -systemctl enable tentacle_serverd.service +# Enable the service on SystemD + systemctl enable tentacle_serverd.service +else + chkconfig tentacle_serverd on +fi + +chkconfig pandora_server on + +# Enable the service on SystemD systemctl enable pandora_server.service diff --git a/pandora_server/util/tentacle_serverd.service b/pandora_server/util/tentacle_serverd.service index e5c3bfad3e..fb6d2af2e3 100644 --- a/pandora_server/util/tentacle_serverd.service +++ b/pandora_server/util/tentacle_serverd.service @@ -1,11 +1,14 @@ [Unit] Description=Tentacle server daemon After=network-online.target +Requires=network.target [Service] Type=forking ExecStart=/usr/bin/tentacle_server -F /etc/tentacle/tentacle_server.conf User=pandora +Restart=on-failure +RestartPreventExitStatus=1 [Install] WantedBy=multi-user.target