How to start an application automatically without login. App should start with OS

Discussion in 'OS X Mountain Lion (10.8)' started by danje, Mar 24, 2013.

  1. macrumors newbie

    Joined:
    Mar 24, 2013
    #1
    Hi all,

    I use ServeToMe as a streaming server with my Mac.

    The tool works very fine.

    But I would like to start the application automatically with the system. So ServeToMe can start without manually launch it or start automatically with a login.

    A try to create a .plist file under /Library/LaunchDaemons

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" 
        "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>Label</key>
    	<string>ServeToMe</string>
        <key>ProgramArguments</key>
    	<array>
    	    <string>/Applications/ServeToMe.app/Contents/MacOS/ServeToMe</string>
    	</array>
        <key>RunAtLoad</key>
    	<true/>
        <key>KeepAlive</key>
    	<true/>
    </dict>
    </plist>
    
    
    But it seems that ServeToMe is not started as I can't connect to the server using StreamToMe.

    Do you have a solution for me?

    Regards
     
  2. macrumors 603

    justperry

    #2
    I am pretty sure it must be in Alphabetical order, screenshots to show you the difference of two .plist files.

    One is yours and one is a working from LittleSnitch
     

    Attached Files:

  3. thread starter macrumors newbie

    Joined:
    Mar 24, 2013
    #3
    Thanks for your answer.

    But I think it's not the good way.
    As when I try to start the plist manually using

    launchctl load -w /Library/LaunchDaemons/ServeToMe.plist

    ServeToMe start as the GUI is displayed and when I try to close the app, it is restarted automatically as I've specified in my .plist file

    However when I restart my macOS, it seems not working :'(

    I'll try to modify my .plist with your order
     
  4. macrumors 603

    justperry

    #4
    As I said before, I am almost 100% sure it needs to be in alphabetical order.
    Also, How did you make the plist, did you use a regular text editor, I have Developer tools installed and that what I use, but you can also use a text editor and then copy and paste it in an HexEditor and than safe the file as a plist file, something which also might affect it is permissions, you might set the permissions to ones similar in the Folder you place it in.
    Another thing is, do you place it in the LaunchAgents or LaunchDeamons, if it does not work in the first one place it in the other one, it might just be you placed it in the wrong Launch.... Folder.

    Edit: If you read the System Log while it is not loaded you might find out why it didn't, believe me, if it doesn't it will say so in the System Log.
     
  5. thread starter macrumors newbie

    Joined:
    Mar 24, 2013
    #5
    I made tests in both Folder LaunchAgents and LaunchDaemons.

    I made a chmod 644 on the file.

    I don't use developer tool for a such file. I'll try to find it for free.

    I'll make the test with your order now.
     
  6. macrumors 603

    justperry

    #6
    AFAIK Developer Tools is free, could be wrong though.
     
  7. thread starter macrumors newbie

    Joined:
    Mar 24, 2013
    #7
    I made new test using this .plist generated by plisteditor

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
            <key>KeepAlive</key>
            <true/>
            <key>Label</key>
            <string>ServeToMe</string>
            <key>ProgramArguments</key>
            <array>
                    <string>/Applications/ServeToMe.app/Contents/MacOS/ServeToMe</string>
            </array>
            <key>RunAtLoad</key>
            <true/>
    </dict>
    </plist>
    
    I've tried in /Library/LaunchAgents and /Library/LaunchDaemons.

    Both try with chmod 644 on the .plist file

    Sniffff :'(
     
  8. thread starter macrumors newbie

    Joined:
    Mar 24, 2013
    #8
    Many other try without success :-/
     
  9. macrumors 603

    justperry

    #9
    What if you put the Application in the startup Folder together with the .plist file?
    But, you then need to change the path in the plist file, you also need to set the correct permissions on the Application.

    If you do this the path in the plist file should be:

    /Library/StartupItems/ServeToMe.app/Contents/MacOS/ServeToMe

    Edit: Be careful, it also might be case sensitive.

    Example, if I want to kill the finder in Terminal killall finder does not work while killall Finder does!
     
  10. thread starter macrumors newbie

    Joined:
    Mar 24, 2013
    #10
    Oh yes good idea.

    I'll try this evening when I'm back from work.

    But can I create a SH script called:

    Start_ServeToMe.sh
    That will point to the application:
    /Applications/ServeToMe.app/Contents/MacOS/ServeToMe

    Then on the StartupItems, I'll put only the script instead of the executable with the .plist file.

    It's just to keep the .app on the /Applications folders.


    Thanks for your help and suggestion!
     
  11. macrumors 603

    justperry

    #11
    That's another option.
     
  12. thread starter macrumors newbie

    Joined:
    Mar 24, 2013
    #12
    So... I'll cancelled this Idea... it's not working, I've headaches.

    I don't understand :-/
     
  13. thread starter macrumors newbie

    Joined:
    Mar 24, 2013
    #13
    I received answer from the ceator of the soft:

    Hi Frank,

    With the current version of ServeToMe, starting on log in is the only way to start the server automatically. The ServeToMe application requires an active user log in to operate so it will fail if run from launchd.

    We are a week or two away from releasing a beta of ServeToMe 4. This version will be a launchd "PrivilegedHelperTools" daemon and will run without an active user log in by default.

    Keep an eye on the ServeToMe page here:

    http://projectswithlove.com/streamtome/servetome.html

    Regards,
    Matt Gallagher.
     
  14. macrumors 603

    justperry

    #14
    No poop.

    So, now you know.

    Just have to wait 2 more weeks, at least it is solved.
     

Share This Page