When I say "hackish solution", I mean something like a CRON job that checks the BT status every second and then forks a child process that runs the script I posted. Which will have problems, outlined below.
My point is that there needs to be a "maintainable solution", so that, for example:
We...