Need help creating Global Daemon for EyeFi Server I have been trying to come up with a headless solution for transferring images from an eyefi card to my mac.  The software from the vendor is decent, but it will only transfer images if there is a user logged into the computer.  I want to use eye-fi cards in an office environment and want to configure it so that the images always are transferred from the card to my mac mini server running Mavericks Server.

So, I found this reference to a python application that does this and runs on synology devices.  http://thijs.elenbaas.net/2013/03/installing-an-eye-fi-server-on-a-synology-nas/

I don't know anything about python except that OSX has it build in.  So I downloaded the software from thijs.elenbaas.net/files/eyefiserver.tar.gz

and configured it on my mac.  It appears to basically be a script called S99EyeFiServer.sh that runs a python app called eyefiserver.py

I had to make a few changes to the S99EyeFiServer.sh script to point it to the correct directories, primarily based on where the whole thing is installed on my mac AND the default pythonpath which on mac is different than on synology.

Bottom line, is I put the eyefi server files into a shared folder and modified the script with the file locations as such:
PIDFILE=/Users/Shared/eyefi/eyefiserver/eyefiserver.pid
DSTPATH=/Users/Shared/eyefi/eyefiserver
PYTHONPATH=/usr/bin

Now, If i go to terminal and do S99EyeFiServer.sh restart or S99EyeFiServer.sh start.  In process viewer, I can see a new process start called "Python" and voila the card will start transferring images.  So, I at least know that this thing can work on the mac. 

Great.  

However, this still doesn't solve my problem.  I need this thing to always run. It does not have any gui or require any interaction, so you ought to be able to run it as a global daemon, right?

So, I fire up launchcontrol and make a .plist for this global daemon





    Label
    com.eyefi.load
    ProgramArguments
    
        /Users/Shared/eyefi/eyefiserver/rc.d/S99EyeFiServer.sh
        restart
    
    RunAtLoad
    



I load this, goto job, click start.  nothing.  no errors.  python app doesn't start.  no images.  

Is it because I'm trying to run it in a shared folder?  So i copied everything into usr/local/eyefiserver, reconfigure the paths and try again.  Again, I can start it from the command line and it will work.  I reconfigure the launch daemon to point it to the script again.  Nothing.  

I then tried playing with user:group settings in launchcontrol, trying to run it as one of my users, either either the setup in the usr/local folder or in the shared folder.  Still nothing.  tried a variety of other user:group settings.  still nothing.

Any advice on making this work?
Don't point launchd to the init.d script but to the program the script executes. It is important that the program does not 'daemonize' (makes itself a background process) itself. This is launchd's job. 

Put this in your ProgramArguments key and you should be fine:

&lt;key&gt;ProgramArguments&lt;/key&gt;
&lt;array&gt;
    &lt;string&gt;/Users/Shared/eyefi/eyefiserver/bin/eyefiserver.py&lt;/string&gt;
    &lt;string&gt;/Users/Shared/eyefi/eyefiserver/etc/eyefiserver.conf&lt;/string&gt;
    &lt;string&gt;/Users/Shared/eyefi/eyefiserver/var/eyefiserver.log&lt;/string&gt;
&lt;/array&gt;