Browse Source

port checker, coredumpchecker

master
mrbesen 10 months ago
parent
commit
a6e9b97b2a
  1. 20
      bot.sh
  2. 12
      coredumps.sh
  3. 2
      hdd.sh

20
bot.sh

@ -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

@ -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

@ -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'
}

Loading…
Cancel
Save