18 lines
538 B
Bash
Executable File
18 lines
538 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
run_directory=$(dirname "$0")
|
|
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
|