diff --git a/watcher/signals/.gitkeep b/events/signals/.blah similarity index 100% rename from watcher/signals/.gitkeep rename to events/signals/.blah diff --git a/watcher/triggers/reboot b/events/triggers/reboot old mode 100644 new mode 100755 similarity index 100% rename from watcher/triggers/reboot rename to events/triggers/reboot diff --git a/watcher/triggers/shutdown b/events/triggers/shutdown similarity index 100% rename from watcher/triggers/shutdown rename to events/triggers/shutdown diff --git a/signal-watcher b/karen similarity index 61% rename from signal-watcher rename to karen index e50c922..9766ece 100755 --- a/signal-watcher +++ b/karen @@ -1,9 +1,12 @@ #!/usr/bin/env bash -root_dir="$(readlink -f $1)" +# karen watches for signals and executes triggers in the events dir +# karen gets triggered a lot +root_dir="$(dirname $(readlink -f ${BASH_SOURCE[0]}))/events" signal_dir="$root_dir/signals" trigger_dir="$root_dir/triggers" +echo "karen is running in $root_dir" fswatch -0 --event=PlatformSpecific $signal_dir | while read -d "" event; do signal="${event#"$signal_dir"}" signal="${signal#"/"}" @@ -11,7 +14,7 @@ fswatch -0 --event=PlatformSpecific $signal_dir | while read -d "" event; do echo "Got signal: $signal" if test -x "$trigger"; then - echo "Executing trigger" + echo "karen is getting triggered!" "$trigger" else echo "No trigger found"