Initial commit

This commit is contained in:
2026-03-26 10:32:29 +01:00
commit 44987dfdba
2 changed files with 68 additions and 0 deletions

19
cert_check.sh Normal file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
script_dir="$(cd "$(dirname "$0")" && pwd)"
cert_valid_for=$(
certbot certificates 2>/dev/null |
grep -A 4 "fm.ines.org.pl" |
grep "Expiry Date" |
awk -F'[()]' '{print $2}' |
awk '{print $2}'
)
cert_valid_for="${cert_valid_for//[^0-9]/}"
cert_valid_for=$((10#${cert_valid_for:-0}))
if (( cert_valid_for < 30 ))
then
python3 "$script_dir/mail.py" --user "certificates@piga.pl" --password 'cgpM!tABM43_meJ' --to "it@piga.pl" --subject "Wygasa certyfikat dla serwera $(hostname)" --body "Certyfikat dla serwera $(hostname) jest ważny jeszcze $cert_valid_for dni."
fi