aboutsummaryrefslogtreecommitdiff
path: root/kvmx
diff options
context:
space:
mode:
Diffstat (limited to 'kvmx')
-rwxr-xr-xkvmx26
1 files changed, 26 insertions, 0 deletions
diff --git a/kvmx b/kvmx
index 5ab776f..e912f84 100755
--- a/kvmx
+++ b/kvmx
@@ -2562,6 +2562,32 @@ function kvmx_growpart {
kvmx_restart
}
+# Inotify dispatcher
+function kvmx_inotify {
+ local watched="$1"
+
+ shift
+ local command="$*"
+
+ # Syntax check
+ if [ -z "$command" ]; then
+ echo "usage $BASENAME inotify $GUEST <watched> <command>"
+ echo "example: kvmx inotify $guest hostfolder make -C guestfolder compile"
+ exit 1
+ fi
+
+ # Check if watched exists
+ if [ ! -e "$watched" ]; then
+ echo "Not found: $watched"
+ exit 1
+ fi
+
+ # Dispatch
+ while inotifywait -r $watched; do
+ echo "$command" | kvmx_ssh
+ done
+}
+
# Dispatch
if type kvmx_$ACTION 2> /dev/null | grep -q "kvmx_$ACTION ()"; then
__kvmx_initialize $*