2022-08-19 13:50:18 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2022-08-19 13:55:49 +02:00
|
|
|
run_directory=$(dirname "$0")
|
2022-08-19 13:50:18 +02:00
|
|
|
source "$run_directory/variables.conf"
|
|
|
|
|
|
|
|
# Set parameters here
|
|
|
|
host=$(hostname -f)
|
|
|
|
sysboot=$(who -b | sed 's/^[ \t]*//;s/[ \t]*$//')
|
|
|
|
time=$(date "+%Y-%m-%d %H:%M:%S")
|
|
|
|
msg="$host has rebooted. $sysboot If you did not initiate this, a power failure has probably occured. Message sent on $time."
|
|
|
|
msg=$(echo $msg | sed -e "s/ /%20/g") # Replace spaces with %20 as we are in an URL
|
|
|
|
|
|
|
|
# Actual process
|
|
|
|
URL="https://smsapi.free-mobile.fr/sendmsg?user=$user&pass=$pass&msg=$msg"
|
|
|
|
curl $URL
|
|
|
|
|
|
|
|
exit 0
|