2010-12-16 Ramon Novoa <rnovoa@artica.es>
* pandora_agent_installer, pandora_agent_daemon: Additional changes to run the agent as a different user. Starting and stopping the daemon did not work except as root. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3664 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
74adbe54c4
commit
329774bb99
|
@ -1,3 +1,9 @@
|
|||
2010-12-16 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* pandora_agent_installer, pandora_agent_daemon: Additional
|
||||
changes to run the agent as a different user. Starting and
|
||||
stopping the daemon did not work except as root.
|
||||
|
||||
2010-12-16 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* DEBIAN/control, DEBIAN/make_deb_package.sh, pandora_console.spec,
|
||||
|
|
|
@ -24,6 +24,7 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
|
|||
PANDORA_PATH=/etc/pandora
|
||||
DAEMON=/usr/bin/pandora_agent
|
||||
LOGFILE=/var/log/pandora/pandora_agent.log
|
||||
PANDORA_USER=root
|
||||
|
||||
# This function replace pidof, not working in the same way in different linux distros
|
||||
|
||||
|
@ -73,8 +74,7 @@ case "$1" in
|
|||
echo "Cannot launch again. Aborting."
|
||||
exit 1
|
||||
fi
|
||||
PATH=$PATH nohup $DAEMON $PANDORA_PATH 2> $LOGFILE &
|
||||
rm nohup.out 2> /dev/null
|
||||
su -c "PATH=$PATH nohup $DAEMON $PANDORA_PATH >/dev/null 2>$LOGFILE &" $PANDORA_USER
|
||||
sleep 2
|
||||
PANDORA_PID=`pidof_pandora`
|
||||
echo "Pandora FMS Agent is now running with PID $PANDORA_PID"
|
||||
|
@ -88,7 +88,7 @@ case "$1" in
|
|||
exit 1
|
||||
else
|
||||
echo "Stopping Pandora Agent."
|
||||
kill -9 $PANDORA_PID > /dev/null 2>&1
|
||||
su -c "kill -9 $PANDORA_PID >/dev/null 2>&1" $PANDORA_USER
|
||||
fi
|
||||
;;
|
||||
|
||||
|
|
|
@ -232,6 +232,9 @@ install () {
|
|||
|
||||
sed -e "s/^DAEMON\=[.]*/DAEMON\=$PANDORA_BASE_DECODED/g" $DAEMON_SCRIPT > $DAEMON_TEMP
|
||||
mv $DAEMON_TEMP $DAEMON_SCRIPT
|
||||
|
||||
sed -e "s/^PANDORA_USER\=.*/PANDORA_USER\=$PANDORA_USER/g" $DAEMON_SCRIPT > $DAEMON_TEMP
|
||||
mv $DAEMON_TEMP $DAEMON_SCRIPT
|
||||
fi
|
||||
|
||||
sed -e "s/^temporal [.]*/temporal $PANDORA_BASE_DECODED/g" $AGENT_CFG > $AGENT_CFG_TEMP
|
||||
|
@ -358,6 +361,8 @@ install () {
|
|||
then
|
||||
cp pandora_agent_daemon /etc/rc.pandora_agent_daemon
|
||||
ln -s /etc/rc.pandora_agent_daemon /etc/rc.d/rc2.d/S90pandora_agent_daemon
|
||||
chmod 755 $PANDORA_STARTUP
|
||||
chown root:root $PANDORA_STARTUP
|
||||
echo "Pandora FMS agent has been included in /etc/rc.d/rc2.d/S90pandora_agent_daemon"
|
||||
fi
|
||||
|
||||
|
@ -367,6 +372,8 @@ install () {
|
|||
cp pandora_agent_daemon $PANDORA_STARTUP
|
||||
ln -s /sbin/init.d/pandora_agent_daemon /sbin/rc3.d/S90pandora_agent_daemon 2> /dev/null
|
||||
ln -s /sbin/init.d/pandora_agent_daemon /sbin/rc2.d/S90pandora_agent_daemon 2> /dev/null
|
||||
chmod 755 $PANDORA_STARTUP
|
||||
chown root:root $PANDORA_STARTUP
|
||||
echo "Pandora FMS agent has been included in /sbin/rcX.d/S90pandora_agent_daemon"
|
||||
fi
|
||||
|
||||
|
@ -375,6 +382,8 @@ install () {
|
|||
PANDORA_STARTUP=/etc/init.d/pandora_agent_daemon
|
||||
cp pandora_agent_daemon $PANDORA_STARTUP
|
||||
ln -s /etc/init.d/pandora_agent_daemon /etc/rc2.d/S90pandora_agent_daemon 2> /dev/null
|
||||
chmod 755 $PANDORA_STARTUP
|
||||
chown root:root $PANDORA_STARTUP
|
||||
echo "Pandora FMS agent has been included in /etc/rc2.d/S90pandora_agent_daemon"
|
||||
fi
|
||||
|
||||
|
@ -390,11 +399,13 @@ install () {
|
|||
ln -s /etc/init.d/pandora_agent_daemon /etc/rc2.d/S90pandora_agent 2> /dev/null
|
||||
ln -s /etc/init.d/pandora_agent_daemon /etc/rc2.d/S90pandora_agent 2> /dev/null
|
||||
fi
|
||||
chmod 755 $PANDORA_STARTUP
|
||||
chown root:root $PANDORA_STARTUP
|
||||
fi
|
||||
|
||||
if [ "$OS_NAME" = "FreeBSD" ]
|
||||
then
|
||||
PANDORA_STARTUP=/usr/local/etc/rc.d/pandora_agent
|
||||
PANDORA_STARTUP=/usr/local/etc/rc.d/pandora_agent
|
||||
cp FreeBSD/pandora_agent $PANDORA_STARTUP
|
||||
chmod 555 $PANDORA_STARTUP
|
||||
chown root:wheel $PANDORA_STARTUP
|
||||
|
|
Loading…
Reference in New Issue