14 lines
406 B
Bash
Executable file
14 lines
406 B
Bash
Executable file
#!/bin/sh
|
|
|
|
URL=kiel.csprung.de
|
|
SERVER_DIR=/opt/container-server
|
|
|
|
cd $SERVER_DIR
|
|
NEW_IP=$(nslookup -type=a $URL | awk '/^Address: / { print $2 ; exit }')
|
|
OLD_IP=$(awk -F '=' '/^FAIL2BAN_IGNORED_IP/{ print $2 }' .env)
|
|
|
|
if [ "$NEW_IP" != "$OLD_IP" ]; then
|
|
echo "Found new IP: $URL = $OLD_IP -> $NEW_IP"
|
|
sed -i -e "s/\(FAIL2BAN_IGNORED_IP\)=.*/\1=$NEW_IP/" .env
|
|
task compose:restart -- fail2ban
|
|
fi
|