monasca-agent/packaging/datadog-agent-rpm/preinst

22 lines
675 B
Plaintext

# Just in case there are leftovers from previous installation (we are now using our own
# supervisord)
getent group dd-agent >/dev/null || groupadd -r dd-agent
getent passwd dd-agent >/dev/null || \
useradd -r -M -g dd-agent -d /usr/share/datadog/agent -s /bin/sh \
-c "Datadog Agent" dd-agent
grep -q "datadog" /etc/supervisord.conf
if [ $? -eq 0 ]
then
echo -n "Removing old configuration from system supervisord"
if [ -x "/usr/bin/supervisorctl" ]
then
supervisorctl stop collector
supervisorctl stop forwarder
fi
/usr/share/datadog/agent/setup-supervisor.py /etc/dd-agent/supervisor.conf /etc/supervisord.conf remove
fi
exit 0