Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
hooks.d for libvirt
#!/bin/bash
# Copy or link this script to /etc/libvirt/hooks/{network,qemu,daemon,lxc}
TYPE=$(basename $0)
HOOKS_PATH="/etc/libvirt/hooks.d/${TYPE}/${1}"
[ ! -e "${HOOKS_PATH}" ] && exit 0
if [ -x "${HOOKS_PATH}/${2}/${3}" ] ; then
exec "${HOOKS_PATH}/${2}/${3}" "$@" <&0
elif [ -x "${HOOKS_PATH}/${2}" ] ; then
exec "${HOOKS_PATH}/${2}" "$@" <&0
elif [ -x "${HOOKS_PATH}" ] ; then
exec "${HOOKS_PATH}" "$@" <&0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment