summaryrefslogtreecommitdiffstats
path: root/notify-reboot
blob: 64291158b0bbdb7536fc1ed2542a29b82428bdd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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))"