Browse Source

karen

power-cycle
Luke Childs 5 years ago
parent
commit
0e9c49b63f
  1. 0
      events/signals/.blah
  2. 0
      events/triggers/reboot
  3. 0
      events/triggers/shutdown
  4. 7
      karen

0
watcher/signals/.gitkeep → events/signals/.blah

0
watcher/triggers/reboot → events/triggers/reboot

0
watcher/triggers/shutdown → events/triggers/shutdown

7
signal-watcher → 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"
Loading…
Cancel
Save