At a simple level, Events in Grouphug work by watching a file and taking action on new lines as they appear. This is our listener. Then to trigger an event, we simply add new lines to that file to tell the listener what to do. Here's a really basic example that assumes you are running bash:
touch /tmp/eventexampleThen we just issue commands from anywhere that can access that file:
while read in;do
echo recieved command $in
done < <(tail -F /tmp/eventexample)
echo cat /etc/hosts>>/tmp/eventexampleAnd this is what it looks like:
This also presents some other really interesting possiblities that are not relevant for discussion here.
Are you ready to try it?