pandorafms/pandora_agents/pc/DEBIAN/postinst

42 lines
1.5 KiB
Bash

#!/bin/bash
PANDORA_LOG=/var/log/pandora/pandora_agent.log
PANDORA_BIN=/usr/bin/pandora_agent
PANDORA_EXEC_BIN=/usr/bin/pandora_agent
PANDORA_HOME=/usr/share/pandora_agent
PANDORA_CFG=/etc/pandora
LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`
#Disabled, now the package overwrite the previous files.
#echo "Copy new version of plugins into dir"
#cp -i /tmp/plugins/* /usr/share/pandora_agent/plugins/
#rm /tmp/plugins -rf
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 700 $PANDORA_EXEC_BIN
#~ chmod 600 $PANDORA_HOME/pandora_agent.conf
chmod -R 700 $PANDORA_HOME/plugins
chown -R root $PANDORA_HOME
chmod 640 $PANDORA_LOG
chgrp root $PANDORA_LOG
chown -R root:root $PANDORA_BIN
chown -R root:root $PANDORA_EXEC_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"