proxmox_routing/inotify-triggered-vm-route-...

10 lines
332 B
Bash
Raw Normal View History

#!/bin/sh
inotifywait -q -m --format '%f' /run/qemu-server/ | while read -r vm; do
# Only act if the line is not empty
if [ ${vm} ] && [ "$(echo ${vm} | sed -E 's/[0-9]{3}(\..*)/\1/')" = ".qmp" ]; then
# The sed transforms 100.pid (or .whatever) to 100
creationRoutesVM $(echo ${vm} | sed -E 's/([0-9]{3})\..*/\1/')
fi
done