You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# 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#"/"}"
|
|
|
|
trigger="$trigger_dir/$signal"
|
|
|
|
|
|
|
|
echo "Got signal: $signal"
|
|
|
|
if test -x "$trigger"; then
|
|
|
|
echo "karen is getting triggered!"
|
|
|
|
"$trigger" &
|
|
|
|
else
|
|
|
|
echo "No trigger found"
|
|
|
|
fi
|
|
|
|
done
|