What's the difference between background and foreground commands?
On Windows, background commands run in the context of the Windows service, so they run as the Local System account by default. The background commands can't display things in the GUI, but because they run as the Local System account they have full access to your PC, so they can do things like reboot or stop/start other services. Also, the Windows service starts when you boot your PC, so you don't have to be logged in for the background commands to run.
On Linux, background commands run as root, in the context of the triggercmdagent daemon.
I haven't written a background service/daemon for Macs yet. Would that be helpful?