summaryrefslogtreecommitdiffstats
path: root/notify-reboot
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2012-01-18 18:00:15 +0100
committerFlorian Pritz <bluewind@xinu.at>2012-01-18 18:00:15 +0100
commit707ed8fac6473124d3bd13a5a12fc3cfff6aebe0 (patch)
tree1b1a37c5ab438e3d1d81003c25e4a9ea3bfe93c2 /notify-reboot
parentb9bb6c9ac6ca2246f30733d7c26d57ff97c91edb (diff)
downloadbin-707ed8fac6473124d3bd13a5a12fc3cfff6aebe0.tar.gz
bin-707ed8fac6473124d3bd13a5a12fc3cfff6aebe0.tar.xz
add notify-reboot and notify-users; change jabberwall to send messages
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'notify-reboot')
-rwxr-xr-xnotify-reboot23
1 files changed, 23 insertions, 0 deletions
diff --git a/notify-reboot b/notify-reboot
new file mode 100755
index 0000000..6429115
--- /dev/null
+++ b/notify-reboot
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+if [[ $# < 2 ]]; then
+ echo "usage: $(basename "$0") <server> <relativ time>"
+ exit
+fi
+
+server="$1"
+orig_date="$2"
+
+date="$(date -d "$orig_date" +%s)"
+if [[ "$date" == "" ]]; then
+ echo "\$date is empty"
+ exit 1
+fi
+
+servername=$(cat ~/"docs/$server/servername")
+if [[ "$servername" == "" ]]; then
+ echo "\"~/docs/$server/servername\" is empty or doesn't exist"
+ exit 1
+fi
+
+notify-users "$server" "Notice: $servername will reboot in $orig_date ($(date -d @$date))"