Page 1 of 1

How to launch Mac standalone version automatically on login

PostPosted: Tue Oct 06, 2015 1:20 pm
by countzer0
Subsonic Version: 5.2.1 (build 4427) – March 4, 2015
Server Version: jetty-6.1.x, java 1.6.0_65, Mac OS X (73.5 MB / 121.8 MB)
Hardware Platform: Mac OS 10.6.8

I have the standalone version installed in /var/subsonic on my Mac. To run it, I have to run the following from a terminal window:

Code: Select all
sudo bash /var/subsonic/subsonic.sh


I want to Subsonic to launch automatically on startup/login. I have tried:

1. Creating an Automator application to run the subsonic.sh script, and setting it as a login item. This fails silently, I guess because it's not able to run as root.

2. Creating an AppleScript to run the subsonic.sh script as an administrator. This fails silently, probably for the same reasons as above.

3. Setting up launchd to run subsonic.sh for all users under root, using the following plist file in /Library/LaunchAgents:

Code: Select all
<?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>Label</key>
      <!-- YOUR SELF-CHOSEN LABEL (TASK ID) HERE -->
    <string>LoginScripts.Subsonic.sh</string>
    <key>ProgramArguments</key>
    <array>
          <!-- YOUR LITERAL SCRIPT PATH HERE -->
        <string>/var/subsonic/subsonic.sh</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>


To test this, I tried:

Code: Select all
sudo launchctl load /Library/LaunchAgents/LoginScripts.Subsonic.plist


This just fails silently. There is nothing in the subsonic.log file.

Why does Subsonic have to run as root? And if so, how do I launch it automatically?

Re: How to launch Mac standalone version automatically on lo

PostPosted: Wed Oct 07, 2015 12:30 am
by timlance
I do not run it as root. I merely have the Subsonic.app in /Applications and have it set to load at startup by adding it to my user's Login items in System Preferences>Users & Groups.

Re: How to launch Mac standalone version automatically on lo

PostPosted: Wed Oct 07, 2015 8:35 am
by countzer0
Thanks for the reply. I'm not referring to the pre-packaged Mac app (which I can't get to run on 10.6.8 ), but the standalone version.

The installation instructions are not very helpful, as they don't tell you that you need to chmod the /var/subsonic folder to 755, or that you need to run the shell script under sudo - I had to find this out by experimenting and searching the forum.