Merge branch 'ent-6039-systemd-en-rpm' into 'develop'

Ent 6039 systemd en rpm

See merge request artica/pandorafms!3332
This commit is contained in:
Alejandro Fraguas 2020-09-08 14:24:58 +02:00
commit a8439eca1b
6 changed files with 101 additions and 21 deletions

View File

@ -108,8 +108,27 @@ mkdir -p /var/spool/pandora/data_out
if [ ! -d /var/log/pandora ]; then if [ ! -d /var/log/pandora ]; then
mkdir -p /var/log/pandora mkdir -p /var/log/pandora
fi fi
/sbin/chkconfig --add pandora_agent_daemon
/sbin/chkconfig pandora_agent_daemon on if [ `command -v systemctl` ];
then
echo "Copying new version of pandora_agent_daemon service"
cp -f /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
if [ "$1" -gt 1 ]
then
echo "If Pandora Agent daemon was running with init.d script,"
echo "please stop it manually and start the service with systemctl"
fi
%preun %preun

View File

@ -98,11 +98,27 @@ fi
cp -aRf /usr/share/pandora_agent/pandora_agent_logrotate /etc/logrotate.d/pandora_agent 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 mkdir -p /var/spool/pandora/data_out
chkconfig pandora_agent_daemon on
if [ `command -v systemctl` ];
then
echo "Copying new version of pandora_agent_daemon service"
cp -f /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
if [ "$1" -gt 1 ]
then
echo "If Pandora Agent daemon was running with init.d script,"
echo "please stop it manually and start the service with systemctl"
fi
%preun %preun

View File

@ -4,6 +4,8 @@ After=network-online.target
[Service] [Service]
ExecStart=/usr/bin/pandora_agent /etc/pandora ExecStart=/usr/bin/pandora_agent /etc/pandora
Restart=on-failure
RestartPreventExitStatus=1
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -110,20 +110,34 @@ exit 0
%post %post
# Initial installation # Initial installation
if [ "$1" = 1 ]; then # Run when not uninstalling
/sbin/chkconfig --add pandora_server if [ "$1" -ge 1 ]
/sbin/chkconfig --add tentacle_serverd then
/sbin/chkconfig pandora_server on if [ `command -v systemctl` ]
/sbin/chkconfig tentacle_serverd on then
echo "Copying new version for tentacle_serverd service"
cp -f /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
echo "Pandora FMS Server configuration is %{_sysconfdir}/pandora/pandora_server.conf" /sbin/chkconfig --add pandora_server
echo "Pandora FMS Server main directory is %{prefix}/pandora_server/" /sbin/chkconfig pandora_server on
echo "The manual can be reached at: man pandora or man pandora_server"
echo "Pandora FMS Documentation is in: http://pandorafms.org" systemctl enable pandora_server.service
echo " "
echo "Pandora FMS Server configuration is %{_sysconfdir}/pandora/pandora_server.conf"
echo "Pandora FMS Server main directory is %{prefix}/pandora_server/"
echo "The manual can be reached at: man pandora or man pandora_server"
echo "Pandora FMS Documentation is in: http://pandorafms.org"
echo " "
fi fi
# This will avoid confi files overwritting on UPGRADES. # This will avoid config files overwritting on UPGRADES.
# Main configuration file # Main configuration file
if [ ! -e "/etc/pandora/pandora_server.conf" ] if [ ! -e "/etc/pandora/pandora_server.conf" ]
then then
@ -144,6 +158,14 @@ fi
echo "Don't forget to start Tentacle Server daemon if you want to receive" echo "Don't forget to start Tentacle Server daemon if you want to receive"
echo "data using tentacle" echo "data using tentacle"
if [ "$1" -gt 1 ]
then
echo "If Tentacle Server daemon was running with init.d script,"
echo "please stop it manually and start the service with systemctl"
fi
%preun %preun
# Upgrading # Upgrading

View File

@ -102,11 +102,21 @@ fi
exit 0 exit 0
%post %post
chkconfig pandora_server on if [ `command -v systemctl` ];
chkconfig tentacle_serverd on then
echo "Copying new version for tentacle_serverd service"
cp -f /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 # Enable the service on SystemD
systemctl enable tentacle_serverd.service 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 systemctl enable pandora_server.service
@ -139,6 +149,14 @@ fi
echo "Don't forget to start Tentacle Server daemon if you want to receive" echo "Don't forget to start Tentacle Server daemon if you want to receive"
echo "data using tentacle" echo "data using tentacle"
if [ "$1" -gt 1 ]
then
echo "If Tentacle Server daemon was running with init.d script,"
echo "please stop it manually and start the service with systemctl"
fi
exit 0 exit 0
%preun %preun

View File

@ -1,11 +1,14 @@
[Unit] [Unit]
Description=Tentacle server daemon Description=Tentacle server daemon
After=network-online.target After=network-online.target
Requires=network.target
[Service] [Service]
Type=forking Type=forking
ExecStart=/usr/bin/tentacle_server -F /etc/tentacle/tentacle_server.conf ExecStart=/usr/bin/tentacle_server -F /etc/tentacle/tentacle_server.conf
User=pandora User=pandora
Restart=on-failure
RestartPreventExitStatus=1
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target