Tue Apr 02, 2013 12:18 am by awb
I can't get the service to load automatically on boot. The .plist file is in the LaunchDaemons folder and the "RunAtLoad" flag is set to true. I can load it manually using launchctl, but it won't start on its own. Anyone have any idea why it might work manually but not automatically? I'm on Mountain Lion 10.8.3.
For the time being, I am using an AppleScript that runs the launchctl command, and I have set it to a login item. But that may not always suit my purposes. In the future, I may want to run the service as root on a system with multiple users so that it will stay open when someone logs out. How do I do this?
-----------------------------------------------------------
@chris0071 - TextEdit may be set to save in Rich Text Format. When interpreted as Unicode text (notice "UTF-8" in line 1 of the .plist file), the text will be interpreted incorrectly and may not be recognized as a legitimate .plist file. You can tell whether this is the case if, when opened in TextEdit, formatting toolbars appear at the top of the window (rtf allows for the inclusion of text formatting instructions). Another giveaway of this would be if TextEdit requires that the "rtf" extension be used when saving.
To be sure, use the aforementioned "plutil" command:
plutil /Library/LaunchDaemons/org.serviio.server.plist
It will probably say something like "unexpected character" and will most likely get tripped up on a "{" in line 1 that denotes formatting instructions and isn't visible to you in the text window.
If this is your problem, then there should be an option somewhere in the TextEdit menus (probably under an "Edit" or "Formatting" menu or something) that allows you to convert to plain text. Hit that and resave (default extension should now be "txt"). Rename the extension to .plist.
Now when you run the "plutil" command, the file should be reported as "OK"
-----------------------------------------------------------
SOLVED:
It was an ownership issue. The .plist file must be owned by root to be launched from the LaunchDaemons folder on boot. Changing ownership of a file can be done using "chown" as root. However, following @ken's original instructions will set the proper ownership, namely this line:
"sudo cp org.serviio.server.plist /Library/LaunchDaemons/"
(I dragged my file into the LaunchDaemons folder and authorized the move when prompted, which does not change the owner from my user to root.)
@TwelveMonkeys - I am not sure why you are having your logout issue unless the owner of the file is not root. I just tested mine after fixing ownership. Everything works as it should. It loads on startup as the user I designated in the file, and after logging out, the server is still running. Are you sure you're looking for the right process name? It won't show up as "Serviio", it will show up as "JavaApplicationStub".