You could set it up as a custom command, that doesn't actually work like the typical custom command.
For example you could create a generic search on "*" and a small time range. Then pipe to your new custom command which runs your script in the background, but it will display the output as results (i.e. anything written to STDOUT).
Quite easy to set a command up, just use the following: