Blog |Follow Nick on Twitter| About
 

Given the popularity of the Playstation 3 Media Server (PSM) I'm a bit confused to why I struggled to find a good solution to this...PSM does does not come with an mac service for running it a boot time, there is a windows service and some stuff for linux if you google but the best effort I could find for OS X was a bodge via SSH!

This is my best effort so far, it's not perfect but it's a start. Below the more link, is a launchd .plist file which if you place in /Library/LaunchDaemons/ will start PSM at boot time, well kinda.

The catch is that a user needs to log in, any user will do, the process will run as the user defined in the .plist file but since PSM requires some kind of windowing libraries it simply will not start until a user logs in!

<?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>com.linickx.ps3m</string>
    <key>ProgramArguments</key>
    <array> 
        <string>/Applications/PS3 Media Server.app/Contents/MacOS/JavaApplicationStub.setenv</string>
    </array>
    <key>UserName</key>
    <string>linickx</string>
    <key>ServiceDescription</key>
    <string>Run PS3 Media at boot</string>
    <key>RunAtLoad</key>
    <true/>
    <key>Nice</key>
    <integer>20</integer>
    <key>KeepAlive</key>
    <true/>
    <key>AbandonProcessGroup</key>
    <true/>
    <key>WorkingDirectory</key>
    <string>/Applications/PS3 Media Server.app/Contents/Resources/Java</string>
    <key>StandardErrorPath</key>
    <string>/Library/Logs/PSM/rror.log</string>
    <key>StandardOutPath</key>
    <string>/Library/Logs/PSM/output.log</string>
    <key>Java</key>
        <dict>
            <key>MainClass</key>
            <string>net.pms.PMS</string>
            <key>JVMVersion</key>
            <string>1.6+</string>
            <key>ClassPath</key>
            <array><string>$JAVAROOT/repo/net/pms/pms/1.72.0/pms-1.72.0.jar</string><string>$JAVAROOT/repo/org/beanshell/bsh-core/2.0b4/bsh-core-2.0b4.jar</string><string>$JAVAROOT/repo/commons-codec/commons-codec/1.7/commons-codec-1.7.jar</string><string>$JAVAROOT/repo/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar</string><string>$JAVAROOT/repo/commons-configuration/commons-configuration/1.9/commons-configuration-1.9.jar</string><string>$JAVAROOT/repo/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar</string><string>$JAVAROOT/repo/commons-io/commons-io/2.4/commons-io-2.4.jar</string><string>$JAVAROOT/repo/commons-lang/commons-lang/2.6/commons-lang-2.6.jar</string><string>$JAVAROOT/repo/com/h2database/h2/1.3.168/h2-1.3.168.jar</string><string>$JAVAROOT/repo/ch/qos/logback/logback-classic/1.0.7/logback-classic-1.0.7.jar</string><string>$JAVAROOT/repo/ch/qos/logback/logback-core/1.0.7/logback-core-1.0.7.jar</string><string>$JAVAROOT/repo/org/apache/sanselan/sanselan/0.97-incubator/sanselan-0.97-incubator.jar</string><string>$JAVAROOT/repo/org/slf4j/slf4j-api/1.7.1/slf4j-api-1.7.1.jar</string><string>$JAVAROOT/repo/org/slf4j/jcl-over-slf4j/1.7.1/jcl-over-slf4j-1.7.1.jar</string><string>$JAVAROOT/repo/com/google/code/gson/gson/2.2.2/gson-2.2.2.jar</string><string>$JAVAROOT/repo/org/hamcrest/hamcrest-integration/1.2.1/hamcrest-integration-1.2.1.jar</string><string>$JAVAROOT/repo/org/hamcrest/hamcrest-library/1.2.1/hamcrest-library-1.2.1.jar</string><string>$JAVAROOT/repo/org/jboss/netty/netty/3.2.7.Final/netty-3.2.7.Final.jar</string><string>$JAVAROOT/repo/maven/maven-nsis-plugin/2.1/maven-nsis-plugin-2.1.jar</string><string>$JAVAROOT/repo/net/java/dev/rome/rome/1.0.0/rome-1.0.0.jar</string><string>$JAVAROOT/repo/jdom/jdom/1.0/jdom-1.0.jar</string><string>$JAVAROOT/repo/net/coobird/thumbnailator/0.4.2/thumbnailator-0.4.2.jar</string><string>$JAVAROOT/repo/org/jaudiotagger/2.0.3/jaudiotagger-2.0.3.jar</string><string>$JAVAROOT/repo/net/java/dev/jna/jna/3.4.0/jna-3.4.0.jar</string><string>$JAVAROOT/repo/com/jgoodies/common/1.2.1/common-1.2.1.jar</string><string>$JAVAROOT/repo/com/jgoodies/forms/1.4.2/forms-1.4.2.jar</string><string>$JAVAROOT/repo/com/jgoodies/looks/2.4.2/looks-2.4.2.jar</string><string>$JAVAROOT/repo/com/github/junrar/junrar/0.7/junrar-0.7.jar</string><string>$JAVAROOT/repo/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar</string><string>$JAVAROOT/repo/org/apache/commons/commons-vfs2/2.0/commons-vfs2-2.0.jar</string><string>$JAVAROOT/repo/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar</string><string>$JAVAROOT/repo/org/apache/maven/scm/maven-scm-api/1.4/maven-scm-api-1.4.jar</string><string>$JAVAROOT/repo/org/codehaus/plexus/plexus-utils/1.5.6/plexus-utils-1.5.6.jar</string><string>$JAVAROOT/repo/org/apache/maven/scm/maven-scm-provider-svnexe/1.4/maven-scm-provider-svnexe-1.4.jar</string><string>$JAVAROOT/repo/org/apache/maven/scm/maven-scm-provider-svn-commons/1.4/maven-scm-provider-svn-commons-1.4.jar</string><string>$JAVAROOT/repo/regexp/regexp/1.3/regexp-1.3.jar</string><string>$JAVAROOT/repo/jwbroek/cuelib/cuelib/1.2.1-2008-06-13/cuelib-1.2.1-2008-06-13.jar</string><string>$JAVAROOT/repo/mediautil/mediautil/1.0/mediautil-1.0.jar</string><string>$JAVAROOT/repo/com/googlecode/xmlwise/1.2/xmlwise-1.2.jar</string><string>$JAVAROOT/repo/com/googlecode/juniversalchardet/juniversalchardet/1.0.3/juniversalchardet-1.0.3.jar</string><string>$JAVAROOT/repo/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar</string></array>
            <key>VMOptions</key>
            <string>-Xmx768M -Xss16M -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -jar</string>
            <key>WorkingDirectory</key>
            <string>$APP_PACKAGE/Contents/Resources/Java</string>
        </dict>
</dict>
</plist>

 

 
Nick Bettison ©