virgahyatt wrote:you should be able to set it up as a daemon so that you don't need to leave the terminal window open. I will see if I can't find the instructions on how to do it. If I remember right mac ports showed how to do it for their myth tv server.
Hey, that would be me!
Briefly, OS X runs all sorts of stuff in the background via "launchd". We create a standard file ("plist") that contains directives to launchd such as:
=the program to execute,
=command line parameters to feed to that program,
=what to do if the program quits (restart, ignore, ...)
=where to store logging and error messages ("stdout", "stderr")
The plist must be stored in a certain place depending on the 'class' of background process ("daemon") you want it to be. System daemons can run as soon as the system starts up and run whether a user is logged in or not. In this case the plist file is stored in '/system/library/launchdaemons'. (You can also just create a soft link into that directory and store the actual file elsewhere.) MythTV's backend runs as a system daemon. A template for the plist file is at:
https://trac.macports.org/browser/trunk/dports/multimedia/mythtv-core.27/files/org.mythtv.mythbackend.plist(At the bottom, under Download in other formats, click the Original format text and it will be done by the time you lift your finger off the mouse button!)
Finally, you have to use the program 'launchctl' to tell launchd that you want to do something with it
- Code: Select all
sudo launchctl load -w /system/library/launchdaemons/org.you.AirSonos.plist
If all is well, the daemon will start up and just work. To make launchd NOT run the daemon:
- Code: Select all
sudo launchctl unload /system/library/launchdaemons/org.you.AirSonos.plist
There are also user agents/daemons that only run when the associated userid is logged in. Those plist files are stored in '~/library/LaunchAgents' and you don't need to add the 'sudo' to the launchctl commands.
HTH,
Craig