-
Notifications
You must be signed in to change notification settings - Fork 21
/
posttrans
executable file
·29 lines (26 loc) · 986 Bytes
/
posttrans
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#! /bin/sh
# This script is RPM-specific
# It is run at the very end of an install/upgrade of the package
# It is NOT run on removal of the package
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 && \
usermod -L dd-agent
# See comment in postinst script for an explanation of the logic below
/etc/init.d/datadog-agent configcheck > /dev/null 2>&1
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo "(Re)starting datadog-agent now..."
/etc/init.d/datadog-agent restart
fi
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
echo "Invalid check configuration. Please run sudo /etc/init.d/datadog-agent configcheck for more details."
exit $RETVAL
fi
fi