PS: 20 seconds is good for my environment - the number of seconds to wait depends on your environment. You should check the plex connect log file: if everything goes well there should be no error message.
Don't mean to confuse anyone here but in my experience I have found a solution using a mix of things if you want to take a look at this post here maybe it will help. I did not edit any plexconnect files either to get it to work outside of the norm. Just wanted to share the info if it helps anyone (updated for mavericks):
PS: 20 seconds is good for my environment - the number of seconds to wait depends on your environment. You should check the plex connect log file: if everything goes well there should be no error message.
Thanks siaccarino. Are you still referring directly to the .py file or to the .bash script now?
Also, I wonder if the sleep request can be put into the plist file itself, so that it survives updates to the PlexConnect.py file?
To start the PlexConnect daemon with a launchd plist on OS X, which file should be specified in the plist: PlexConnect_daemon.py or PlexConnect_daemon.bash?
Using Lingon, I created launchagent plists for both PlexConnect_daemon.py and PlexConnect_daemon.bash. Neither worked. I tried "run at load" and "keep alive." Sill no luck.
The Lingon FAQ has the following about why some launchd jobs don't work. Maybe something in it will help others here. It's beyond me, I think.
My job doesn't run, what has gone wrong?
Usually when a job doesn't run it is because the underlying system process (launchd - see above) doesn't think that the job is correct or that it is too complex. One of the things that you can't do is to use a pipe or use something like "exec" or "%gt;". But you can solve most problem easily when you have a really complex command by putting that command into a script and then run that script with Lingon. You can also check to see that the whole paths to any commands are included and if you run a script that references or outputs files, that you include the whole path. Also make sure that if you want to run an AppleScript to run it with the command /usr/bin/osascript or compile it as an application. And for any script that you run make sure that the script is set as an executable or is run with another command such as /usr/bin/python /path/to/script
It looks like you might have to wait for Bywnants to have some more time to look at OSX specifics to ensure it is working fully with launchctl (it does already work for launching in the background).
The daemon code now works on OSX as well as Linux.
There are also some specific scripts in the “support/OSX” folder to enable/disable it automatically launching at boot as well as generate certs if you need them).
Here it is, I will give it a try. Wasn’t sure how to stop it if needed to update plexconnect, look like this explains it well enough for osx though, looks pretty straight forward using launchctl as I figured it would, this should simplify things on osx for sure, great update guys (looks like all the instructions are in the support folder as well)
*Tested and working as advertised on 10.9 mavericks but when I tried to unload the plist it is still running, using this to unload it as I assume it was intended for:
Using your code I made two files to stop and start it easily for now and stuck them in /plexconnect/support/OSX and it it seems to do the job until it can be figured out whats not stopping it in launchctl:
sudo su
cd /plexconnect/support/OSX
./stopdaemon.bash
./startdaemon.bash
On second thought you really dont need these as you can just run this to start or stop plexconnect