Created
April 28, 2025 08:30
-
-
Save disafronov/081e2f90ca49f46a6d8efe0d31f66f95 to your computer and use it in GitHub Desktop.
Proxmox DHCP watchdog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
restore_dhcp() { | |
if [ -n "$(grep 'iface vmbr0 inet static' /etc/network/interfaces)" ]; then | |
sed -e 's|iface\ vmbr0\ inet\ static|iface\ vmbr0\ inet\ dhcp|g' -i /etc/network/interfaces | |
fi | |
} | |
restore_dhcp | |
inotifywait -e close_write,moved_to,create -m /etc/network | | |
while read -r directory events filename; do | |
if [ "$filename" = "interfaces" ]; then | |
restore_dhcp | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment