Table of Contents

PlayStation Media Server

PlayStation Media Server is a java app that serves up files to your PS3.

init script

Crude, but works.

/etc/rc.d/rc.pmsd

#!/bin/sh
#
# PS3 MediaServer Slackware init script
#
# make symlink for debug log:
# /usr/local/bin/pms/debug.log -> /dev/null
#
# stopping works
# starting works (the java_opts work)
# logging added
 
JAVA_HOME=/usr/lib/java
export JAVA_HOME
JAVA_OPTS='-Djava.awt.headless=true'
export JAVA_OPTS
 
PMSDIR=/usr/libexec/pms
#PMSDIR=/home/john/bin/pms/pms-linux-1.10.5
 
PMSLOG=/var/log/pms.log
PMS=$PMSDIR/PMS.sh
PMSJAR=pms.jar
 
NAME='PS3 MediaServer'
 
PMSPID=`pgrep -f "\-jar $PMSDIR/$PMSJAR" || echo 0`
KILLTIME=5
 
start() {
    if [ $PMSPID == 0 ]; then
        if [ -x $PMS ]; then
            echo "Starting $NAME: $PMS"
            cd $PMSDIR
            $PMS >> $PMSLOG 2>&1 &
            sleep 1
        fi
    else
        echo "$NAME already running. pid: $PMSPID"
    fi
}
 
stop() {
    if [ $PMSPID == 0 ]; then
        echo "$NAME not running, no pid to kill"
    else
        echo "Stopping $NAME..."
        killpms
    fi
}
 
killpms() {
    PMSPID=`pgrep -f "\-jar $PMSDIR/$PMSJAR" || echo 0`
    if [ $PMSPID != 0 ]; then
       echo "killing PID $PMSPID"
       kill $PMSPID 2> /dev/null
       sleep $KILLTIME
       killpms
    fi
}
 
# How to call it.
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        stop
        start
        ;;
    status)
        echo "$NAME pid: $PMSPID"
        ;;
    *)
        echo $"Usage: $0 {start|stop|restart|status}"
        ;;
esac

logrotate script

Put the following into /etc/logrotate.d/pms

/var/log/pms.log {
    sharedscripts
    postrotate
        /etc/rc.d/rc.pmsd restart
    endscript
}

PMS.conf

thumbnails = false
mencoder_ass = true
network_interface = eth0
hostname = 192.168.1.2
mencoder_remux_ac3 = true
folders = \/wspace
minimized = true