54 lines
1.7 KiB
Bash
Executable File
54 lines
1.7 KiB
Bash
Executable File
#! /bin/bash
|
|
|
|
set -e
|
|
|
|
case "$1" in
|
|
configure)
|
|
update-rc.d mon-agent defaults
|
|
adduser --system mon-agent --disabled-login --shell /bin/sh --no-create-home --quiet
|
|
usermod -d /usr/share/datadog/agent mon-agent
|
|
mkdir -p /var/log/mon-agent
|
|
[ ! -e /usr/bin/mon-agent ] && ln -s /usr/share/pyshared/monagent/agent.py /usr/bin/mon-agent
|
|
[ ! -e /etc/mon-agent/config.py ] && ln -s /usr/share/pyshared/monagent/config.py /etc/mon-agent/config.py
|
|
[ ! -e /usr/bin/dogstatsd ] && ln -s /usr/share/pyshared/tests/test_dogstatsd.py /usr/bin/dogstatsd
|
|
[ ! -d /etc/dd-agent ] && ln -s /etc/monagent /etc/dd-agent
|
|
chmod +x /usr/share/pyshared/monagent/agent.py
|
|
chmod +x /usr/share/pyshared/tests/test_dogstatsd.py
|
|
chown root:root /etc/init.d/mon-agent
|
|
chown -R mon-agent:root /etc/mon-agent
|
|
chown -R mon-agent:root /var/log/mon-agent
|
|
chown -R root:root /usr/share/pyshared/monagent/
|
|
chown -h root:root /usr/bin/dogstatsd
|
|
chown -h root:root /usr/bin/mon-agent
|
|
# chown -h root:root /usr/bin/dd-forwarder
|
|
|
|
set +e
|
|
|
|
if which invoke-rc.d >/dev/null 2>&1; then
|
|
invoke-rc.d mon-agent restart
|
|
else
|
|
/etc/init.d/mon-agent restart
|
|
fi
|
|
|
|
RETVAL=$?
|
|
if [ $RETVAL -ne 0 ]; then
|
|
if [ $RETVAL -eq 3 ]; then
|
|
# No datadog.conf file is present. The user is probably following
|
|
# the step-by-step instructions and will add the config file next.
|
|
exit 0
|
|
else
|
|
exit $?
|
|
fi
|
|
fi
|
|
;;
|
|
abort-upgrade|abort-remove|abort-deconfigure)
|
|
;;
|
|
|
|
*)
|
|
;;
|
|
esac
|
|
|
|
#DEBHELPER#
|
|
|
|
exit 0
|