From 26d4a2e21988a9ece682ec766961fcd63c4e1503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lecour?= Date: Mon, 2 Mar 2020 22:10:31 +0100 Subject: [PATCH] Notify syslog when partitions are re-mounted (Linux) --- evomaintenance.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/evomaintenance.sh b/evomaintenance.sh index 0270c60..8d17f8e 100755 --- a/evomaintenance.sh +++ b/evomaintenance.sh @@ -54,6 +54,12 @@ Options END } +syslog() { + if [ -x "${LOGGER_BIN}" ]; then + ${LOGGER_BIN} -t "evomaintenance" "$1" + fi +} + get_system() { uname -s } @@ -184,6 +190,7 @@ remount_repository_readwrite() { else mountpoint=$(stat -c '%m' $1) mount -o remount,rw ${mountpoint} + syslog "Re-mount ${mountpoint} as read-write to commit in repository $1" fi } remount_repository_readonly() { @@ -193,6 +200,7 @@ remount_repository_readonly() { else mountpoint=$(stat -c '%m' $1) mount -o remount,ro ${mountpoint} 2>/dev/null + syslog "Re-mount ${mountpoint} as read-only after commit to repository $1" fi } @@ -512,6 +520,9 @@ if [ "${HOOK_API}" = "1" ] && [ -z "${CURL_BIN}" ]; then echo "No \`curl' command has been found, can't call the API." 2>&1 fi +LOGGER_BIN=$(command -v logger) +readonly LOGGER_BIN + if [ "${HOOK_API}" = "1" ] && [ -z "${API_ENDPOINT}" ]; then echo "No API endpoint specified, can't call the API." 2>&1 fi