From c3824c3e5652eeb059653a385a6bd629bad0fc38 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Wed, 19 May 2010 21:21:43 +0000 Subject: [PATCH] Last changes for Ramon. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2762 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_agents/linux/DEBIAN/prerm | 2 +- pandora_agents/unix/DEBIAN/postinst | 35 +++++++++++++++++++++++++++++ pandora_agents/unix/DEBIAN/prerm | 12 ++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100755 pandora_agents/unix/DEBIAN/postinst create mode 100755 pandora_agents/unix/DEBIAN/prerm diff --git a/pandora_agents/linux/DEBIAN/prerm b/pandora_agents/linux/DEBIAN/prerm index ede6b26aeb..e40e66faa1 100755 --- a/pandora_agents/linux/DEBIAN/prerm +++ b/pandora_agents/linux/DEBIAN/prerm @@ -9,4 +9,4 @@ rm -rf $PANDORA_CFG/plugins rm -rf $PANDORA_CFG/pandora_agent.conf INITLV=`cat /etc/inittab | grep "[0-9]\:initdefault" | cut -f 2 -d ":"` -rm /etc/rc$INITLV.d/S90pandora_agent +rm /etc/rc$INITLV.d/S90pandora_agent_daemon diff --git a/pandora_agents/unix/DEBIAN/postinst b/pandora_agents/unix/DEBIAN/postinst new file mode 100755 index 0000000000..f8393612af --- /dev/null +++ b/pandora_agents/unix/DEBIAN/postinst @@ -0,0 +1,35 @@ +#!/bin/bash + +PANDORA_LOG=/var/log/pandora/pandora_agent.log +PANDORA_BIN=/usr/bin/pandora_agent +PANDORA_HOME=/usr/share/pandora_agent +PANDORA_TEMP=/var/spool/pandora/data_out +PANDORA_CFG=/etc/pandora + +LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"` + +echo "Linking Pandora FMS Agent plugins directory to $PANDORA_CFG/plugins..." +rm $PANDORA_CFG/plugins 2> /dev/null +ln -s $PANDORA_HOME/plugins $PANDORA_CFG 2> /dev/null + +echo "Linking Pandora FMS Agent configuration to $PANDORA_CFG/pandora_agent.conf..." +rm $PANDORA_CFG/pandora_agent.conf 2> /dev/null +ln -s $PANDORA_HOME/pandora_agent.conf $PANDORA_CFG/pandora_agent.conf + +echo "Start log of agent." +echo "$LOG_TIMESTAMP Pandora FMS installer has created this file at startup" > $PANDORA_LOG + +echo "Setting secure permissions and ownership for all Pandora FMS Agent files..." +chmod 700 $PANDORA_BIN +chmod 600 $PANDORA_HOME/pandora_agent.conf +chmod -R 700 $PANDORA_HOME/plugins +chown -R root $PANDORA_HOME +chmod -R 600 $PANDORA_TEMP +chmod 640 $PANDORA_LOG +chgrp root $PANDORA_LOG +chown -R root:root $PANDORA_BIN + +echo "Linking start-up daemon script to /etc/rc$INITLV.d"; +update-rc.d pandora_agent_daemon defaults + +echo "Please, now setup the $PANDORA_HOME/pandora_agent.conf and before start the /etc/init.d/pandora_agent_daemon" diff --git a/pandora_agents/unix/DEBIAN/prerm b/pandora_agents/unix/DEBIAN/prerm new file mode 100755 index 0000000000..1c800d2e65 --- /dev/null +++ b/pandora_agents/unix/DEBIAN/prerm @@ -0,0 +1,12 @@ +#!/bin/bash + +echo Stop Pandora agent daemon +/etc/init.d/pandora_agent_daemon stop + +PANDORA_CFG=/etc/pandora + +rm -rf $PANDORA_CFG/plugins +rm -rf $PANDORA_CFG/pandora_agent.conf + +update-rc.d -f pandora_agent_daemon remove +