This commit is contained in:
mrbesen 2019-05-02 20:41:03 +02:00
commit 818f7abbe2
3 changed files with 25 additions and 0 deletions

6
boot.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
#notify on reboot
. func.sh
send "Server%20started."

10
bot.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
# the main bot script
#hdd usage
used=$(df --output=pcent /dev/sda3 | tail -1 | grep -Po "(\\d+)" --color=never)
if [ "$used" -gt 50 ]; then
. func.sh
echo "warn!"
send "warnung%20server%20used%20$used%25%20of%20the%20storage!"
fi

9
func.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
token="APItoken"
userid="usernameorid"
#1. arg = text
send() {
echo "Sending $1 to ${userid}"
curl -s "https://api.telegram.org/bot${token}/sendMessage?chat_id=${userid}&text=$1" > /dev/null
}