port checker, coredumpchecker

master
mrbesen 2021-08-11 15:54:41 +02:00
parent 9565482b65
commit a6e9b97b2a
3 changed files with 33 additions and 1 deletions

20
bot.sh
View File

@ -67,6 +67,26 @@ if [ "$?" -gt "0" ]; then
fi
unset -f checkCert
#check availablitiy of "forbidden" ports
curl 'http://mrbesen.de:9999' --output - -s > /dev/null
if [ "$?" -eq "0" ]; then
echo "9999 public!"
printf -v msg '%b\n\nport 9999 public iptable reules broken?' "${msg}"
ident="$ident:firewall"
fi
# check for new coredumps
. coredumps.sh
checkCoreDump
if [ "$?" -ne "0" ]; then
echo "new coredump"
printf -v msg '%b\n\nnew coredump' "${msg}"
ident="$ident:coredump"
fi
unset -f checkCoreDump
. func.sh
if [[ "${#msg}" -gt "1" ]]; then
#remove prepend

12
coredumps.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
function checkCoreDump {
SAVEFILE="coredumpcount"
coredumpcount=$(ls "/var/lib/systemd/coredump/" | wc -l)
lastcount=$(cat "${SAVEFILE}")
echo "${coredumpcount}" > "${SAVEFILE}"
if [ "$coredumpcount" -gt "${lastcount}" ]; then
return 1
fi
return 0
}

2
hdd.sh
View File

@ -4,5 +4,5 @@ function hddUsage {
}
function hddTop {
du -hd 3 / --exclude="/proc" | sort -hr | grep -E "/.*/.*/" | head -n 3 | sed -e 's/\t/%20/g; s:/:%2F:g; a%0A' | sed -e '1i \%0A' | tr -d '\n'
du -hd 3 / --exclude="/proc" --exclude="/media" --exclude="/mnt" --exclude="/usr/local/bin/dchub/share" | sort -hr | grep -E "/.*/.*/" | head -n 3 | sed -e 's/\t/%20/g; s:/:%2F:g; a%0A' | sed -e '1i \%0A' | tr -d '\n'
}