X-Git-Url: https://git.madduck.net/code/molly-guard.git/blobdiff_plain/1f5b1eab70026bea6c580bb09aa7bf4c3293b605..7667c0bdc5a25496d9226ad1da08e4cfda980464:/checks.d/10-print-message diff --git a/checks.d/10-print-message b/checks.d/10-print-message new file mode 100755 index 0000000..cb4a483 --- /dev/null +++ b/checks.d/10-print-message @@ -0,0 +1,28 @@ +#!/bin/sh +# +# print a warning message before rebooting/shutting down etc a machine. +# +# Copyright Andrew Ruthven +# Released under the terms of the Artistic Licence 2.0 +# +# Cat out either /etc/molly-guard.$CMD.message +# or /etc/molly-guard.message +# If present. +CMD=$1; shift + +FILE= +BANNER= + +if [ -f /etc/molly-guard.$CMD.message ]; then + echo "$(hostname -s) has a $CMD warning message:" + FILE=/etc/molly-guard.$CMD.message +elif [ -f /etc/molly-guard.message ]; then + FILE=/etc/molly-guard.message + echo "$(hostname -s) has a warning message:" +fi + +if [ "x$FILE" != "x" ]; then + echo $BANNER + cat $FILE + echo "" +fi