From ea1235ab0adb279ae4c9111dc6c07d5069d0656f Mon Sep 17 00:00:00 2001 From: slerena Date: Mon, 1 Apr 2013 01:28:14 +0000 Subject: [PATCH] 2013-04-01 Sancho Lerena * DEBIAN/postinst, pandora_server.redhat.spec, pandora_server.spec, pandora_server_installer: Moved maintance process to hourly instead daily. Improves performance and avoid locks on heavy loaded systems. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7902 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 9 +++++++++ pandora_server/DEBIAN/postinst | 12 ++++++------ pandora_server/DEBIAN/prerm | 4 ++-- pandora_server/pandora_server.redhat.spec | 8 ++++---- pandora_server/pandora_server.spec | 6 +++--- pandora_server/pandora_server_installer | 14 +++++++------- pandora_server/pandora_server_upgrade | 10 ++++++---- 7 files changed, 37 insertions(+), 26 deletions(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 2a63589fb8..8aeb02110e 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,12 @@ +2013-04-01 Sancho Lerena + + * DEBIAN/postinst, + pandora_server.redhat.spec, + pandora_server.spec, + pandora_server_installer: Moved maintance process to hourly + instead daily. Improves performance and avoid locks on heavy + loaded systems. + 2013-03-26 Ramon Novoa * lib/PandoraFMS/Core.pm, diff --git a/pandora_server/DEBIAN/postinst b/pandora_server/DEBIAN/postinst index 492dcd99df..061e0703b7 100755 --- a/pandora_server/DEBIAN/postinst +++ b/pandora_server/DEBIAN/postinst @@ -88,14 +88,14 @@ update-rc.d pandora_server defaults echo "Installing tentacle server in /etc/rc2.d/S80tentacle_serverd" update-rc.d tentacle_serverd defaults -if [ -d /etc/cron.daily ] +if [ -d /etc/cron.hourly ] then - echo "Create the Cron script to run daily Pandora DB tool" - echo "#!/bin/bash" > /etc/cron.daily/pandora_db - echo "perl /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf" >> /etc/cron.daily/pandora_db - chmod 750 /etc/cron.daily/pandora_db + echo "Create the Cron script to run hourly Pandora DB tool" + echo "#!/bin/bash" > /etc/cron.hourly/pandora_db + echo "perl /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf" >> /etc/cron.hourly/pandora_db + chmod 750 /etc/cron.hourly/pandora_db else - echo "You're probably not using cron for automatic scheduling. You should schedule the following command to run frequently (daily) on your master server:" + echo "You're probably not using cron for automatic scheduling. You should schedule the following command to run frequently (each hour) on your master server:" echo " perl /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf" fi diff --git a/pandora_server/DEBIAN/prerm b/pandora_server/DEBIAN/prerm index ec5a25a8d9..4d91cc7df0 100755 --- a/pandora_server/DEBIAN/prerm +++ b/pandora_server/DEBIAN/prerm @@ -65,9 +65,9 @@ rm /etc/init.d/tentacle_serverd update-rc.d pandora_server remove update-rc.d tentacle_serverd remove -if [ -d /etc/cron.daily ] +if [ -d /etc/cron.hourly ] then - rm /etc/cron.daily/pandora_db + rm /etc/cron.hourly/pandora_db fi rm /usr/bin/pandora_exec diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index aad80c1efa..ce3be45b23 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -53,7 +53,7 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/pandora/ mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_server/conf/ mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1/ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/ -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/ +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/cron.hourly/ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/pandora/.ssh mkdir -p $RPM_BUILD_ROOT/usr/lib/perl5/ @@ -78,11 +78,11 @@ rm -f $RPM_BUILD_ROOT%{prefix}/pandora_server/util/recon_scripts/PandoraFMS install -m 0644 util/pandora_logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_server install -m 0640 conf/pandora_server.conf $RPM_BUILD_ROOT%{_sysconfdir}/pandora/ -cat < $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/pandora_db +cat < $RPM_BUILD_ROOT%{_sysconfdir}/cron.hourly/pandora_db #!/bin/bash %__perl %{prefix}/pandora_server/util/pandora_db.pl %{_sysconfdir}/pandora/pandora_server.conf EOF -chmod 0755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/pandora_db +chmod 0755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.hourly/pandora_db %clean rm -fr $RPM_BUILD_ROOT @@ -135,7 +135,7 @@ exit 0 %doc AUTHORS COPYING ChangeLog README %{_sysconfdir}/rc.d/init.d/pandora_server %{_sysconfdir}/rc.d/init.d/tentacle_serverd -%{_sysconfdir}/cron.daily/pandora_db +%{_sysconfdir}/cron.hourly/pandora_db %config(noreplace) %{_sysconfdir}/logrotate.d/pandora_server %defattr(755,pandora,root) diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 5a589a2d6a..ca6eeb3807 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -101,8 +101,8 @@ fi chkconfig pandora_server on chkconfig tentacle_serverd on -echo "/usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf" > /etc/cron.daily/pandora_db -chmod 750 /etc/cron.daily/pandora_db +echo "/usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf" > /etc/cron.hourly/pandora_db +chmod 750 /etc/cron.hourly/pandora_db cp -aRf /usr/share/pandora_server/util/pandora_logrotate /etc/logrotate.d/pandora if [ ! -d /etc/pandora ] ; then @@ -149,7 +149,7 @@ rm -Rf /etc/pandora/pandora_server.conf rm -Rf /var/spool/pandora rm -Rf /etc/init.d/pandora_server /etc/init.d/tentacle_serverd rm -Rf /usr/bin/pandora_exec /usr/bin/pandora_server /usr/bin/tentacle_server -rm -Rf /etc/cron.daily/pandora_db +rm -Rf /etc/cron.hourly/pandora_db rm -Rf /etc/logrotate.d/pandora rm -Rf /usr/share/man/man1/pandora_server.1.gz rm -Rf /usr/share/man/man1/tentacle_server.1.gz diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index bc150c4b88..d0994f828a 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -374,12 +374,12 @@ perl-TimeDate perl-XML-Simple perl-XML-Twig perl-libwww-perl mysql-client perl-S mkdir $PANDORA_HOME 2> /dev/null cp -R util $PANDORA_HOME - if [ -d /etc/cron.daily ] + if [ -d /etc/cron.hourly ] then - echo "Creating the Cron script to run daily Pandora DB tool" - echo "#!/bin/bash" > /etc/cron.daily/pandora_db - echo "perl /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf" >> /etc/cron.daily/pandora_db - chmod +x /etc/cron.daily/pandora_db + echo "Creating the Cron script to run Pandora DB tool each hour" + echo "#!/bin/bash" > /etc/cron.hourly/pandora_db + echo "perl /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf" >> /etc/cron.hourly/pandora_db + chmod +x /etc/cron.hourly/pandora_db else if [ "$DISTRO" = "FreeBSD" ] then @@ -392,7 +392,7 @@ perl-TimeDate perl-XML-Simple perl-XML-Twig perl-libwww-perl mysql-client perl-S echo "The crontab for pandora_db.pl is already configured." fi else - echo "You're probably not using cron for automatic scheduling. You should schedule the following command to run frequently (daily) on your master server:" + echo "You're probably not using cron for automatic scheduling. You should schedule the following command to run frequently (hourly) on your master server:" echo " perl /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf" fi fi @@ -480,7 +480,7 @@ uninstall () { rm -Rf /usr/bin/pandora_server 2> /dev/null rm -Rf /usr/bin/pandora_exec 2> /dev/null rm -Rf $PANDORA_HOME - rm -Rf /etc/cron.daily/pandora_db + rm -Rf /etc/cron.hourly/pandora_db rm -Rf /etc/logrotate.d/pandora if [ "$DISTRO" = "UBUNTU" ] || [ "$DISTRO" = "DEBIAN" ] then diff --git a/pandora_server/pandora_server_upgrade b/pandora_server/pandora_server_upgrade index 48664d146d..8cef77a2c5 100755 --- a/pandora_server/pandora_server_upgrade +++ b/pandora_server/pandora_server_upgrade @@ -47,10 +47,12 @@ install () { cp util/pandora_server /etc/init.d cp util/tentacle_serverd /etc/init.d - if [ ! -e /etc/cron.daily/pandora_db ] + if [ ! -e /etc/cron.hourly/pandora_db ] then - echo "You don't have a /etc/cron.daily/pandora_purge_db file, you should consider" - echo "to setup the Pandora FMS daily Database Maintance script: " + echo "You don't have a /etc/cron.hourly/pandora_db file, you should consider" + echo "to setup the Pandora FMS Database Maintance script. Create with 755 perms a file in /etc/cron.hourly " + echo "called 'pandora_db', with following contents: " + echo " " echo " perl /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf" fi @@ -66,7 +68,7 @@ help () { # Script banner at start echo " " -echo "Pandora FMS 4.0dev Server Upgrade (c) 2009-2010 Artica ST" +echo "Pandora FMS 5.0 Server Upgrade (c) 2009-2013 Artica ST" echo "This program is licensed under GPL2 Terms. http://pandorafms.org" echo " "