]> git.madduck.net Git - code/molly-guard.git/blob - checks.d/10-print-message

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

reformat help output
[code/molly-guard.git] / checks.d / 10-print-message
1 #!/bin/sh
2 #
3 # print a warning message before rebooting/shutting down etc a machine.
4 #
5 # Copyright <C2><A9> Andrew Ruthven <andrew@etc.gen.nz>
6 # Released under the terms of the Artistic Licence 2.0
7 #
8 # Cat out either /etc/molly-guard.$CMD.message
9 #             or /etc/molly-guard.message
10 # If present.
11 CMD=$1; shift
12
13 FILE=
14 BANNER=
15
16 if [ -f /etc/molly-guard.$CMD.message ]; then
17   echo "$(hostname -s) has a $CMD warning message:"
18   FILE=/etc/molly-guard.$CMD.message
19 elif [ -f /etc/molly-guard.message ]; then
20   FILE=/etc/molly-guard.message
21   echo "$(hostname -s) has a warning message:"
22 fi
23
24 if [ "x$FILE" != "x" ]; then
25   echo $BANNER
26   cat $FILE
27   echo ""
28 fi