22 lines
545 B
Text
22 lines
545 B
Text
|
#!/bin/sh -e
|
||
|
|
||
|
STATE="$(cat "${__object}/parameter/state")"
|
||
|
if [ "${STATE}" != "present" ]; then
|
||
|
exit
|
||
|
fi
|
||
|
|
||
|
ETC_DIR="/etc"
|
||
|
SERVICE_NAME="${__object_id}"
|
||
|
CONFIG_FILE_DEST="${ETC_DIR}/${SERVICE_NAME}.conf"
|
||
|
|
||
|
BIN_DIR="/usr/local/bin"
|
||
|
VERSION_FILE="${BIN_DIR}/.${SERVICE_NAME}.cdist.version"
|
||
|
|
||
|
# We only restart here if there was a config change
|
||
|
# but there was not a version change
|
||
|
if grep -qE "^__file${CONFIG_FILE_DEST}" "${__messages_in}" && \
|
||
|
grep -qvE "^__file${VERSION_FILE}" "${__messages_in}"; then
|
||
|
echo "service ${SERVICE_NAME} restart"
|
||
|
fi
|
||
|
|