PS3 Media Server as a Linux Service

For help and support with issues specific to Linux/Unix
Forum rules
Please make sure you follow the Problem Reporting Guidelines before posting if you want a reply.

PS3 Media Server as a Linux Service

Postby BlueBus » Thu Jan 22, 2009 4:36 pm

Hello,

Is there any recommended way to make PS3 MEdia Server to work as a Linux Service?

I've read that I must run it with GUI at least once, to save the preferences but how can I further add it to boot and run it as a deamon?

Thank you for the great software.

Best Regards.
BlueBus
 
Posts: 6
Joined: Thu Jan 22, 2009 4:32 pm

Re: PS3 Media Server as a Linux Service

Postby NikNac » Thu Jan 22, 2009 7:42 pm

You can set a lot of the config settings by manually editing the PMS.conf file so You don't need to use the GUI. The one thing I haven't been able to find out how to do is a media library scan from the conf file. I think that must be part of the Java code.

In terms of running PMS as a service on a Linux server - there are posts about this and from what I've seen you add the app as you would any other service. Here is a good explanation of what to do - http://www.ibm.com/developerworks/linux ... onfig.html
NikNac
 
Posts: 16
Joined: Mon Jan 19, 2009 5:31 am

Re: PS3 Media Server as a Linux Service

Postby Nojatron » Sun Feb 08, 2009 12:37 pm

Anyone had any luck writing a init script for this?

I can get it started in the background using screen, but no idea how to kill it in the stop part without a pid file.
Nojatron
 
Posts: 7
Joined: Sun Feb 08, 2009 12:34 pm

Re: PS3 Media Server as a Linux Service

Postby sanju » Sun Feb 08, 2009 8:49 pm

I am runnig PMS as linux daemon (on Ubuntu 8.10)..so would like share what i did...

First untar PMS at some folder..lets call it PMS_FOLDER.

1. go to folder /etc/init.d
2. create a new file PS3MediaServerd with following content..(you will have to use sudo..for e.g sudo vim PS3MediaServerd ).

/**************************************************************************************/
#Modify path as per your need..here is default for me..
PATH=PMS_FOLDER:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin

DESC="PS3 UPnP Media Server"
NAME=PMS.sh
#Don't forget to put proper PMS folder name here.
DAEMON=PMS_FOLDER/PMS.sh

# replace userid with the one ,with which access you want to run PMS..This user and group # should exist in /etc/passwd and /etc/group...
PMSUSER=userid
PMSGROUP=userid

# Exit if the package is not installed
if [ ! -x "$DAEMON" ]; then
{
echo "Couldn't find $DAEMON"
exit 99
}
fi

#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
cd PMS_FOLDER
start-stop-daemon --start --quiet --chuid $PMSUSER:$PMSGROUP --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --chuid $PMSUSER:$PMSGROUP --exec $DAEMON \
|| return 2
}


#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --signal 2 --retry 5 --quiet --name java
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
return "$RETVAL"
}

case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) log_end_msg 0 ;;
2) log_end_msg 1 ;;
esac
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) log_end_msg 0 ;;
2) log_end_msg 1 ;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop}" >&2
exit 3
;;
esac

:

/*******************************************************************************/

#Now make PS3MediaServerd executable.
3. chmod +x PS3MediaServerd

4. Now our PMS daemon start script is ready..we have to add this in intialization script..so it runs during boot time. excute on command prompt.

>update-rc.d PS3MediaServerd defaults 60


5. Now go to PMS_FOLDER..and open PMS.sh ..go to the last line.
It should be
exec "$JAVA" $JAVA_OPTS -Xmx768M -Djava.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -jar "$PMS_JAR" "$@"

Now change this to:
cd PMS_FOLDER
exec "$JAVA" $JAVA_OPTS -Xmx768M -Djava.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -jar "$PMS_JAR" "$@" &




Thats all..reboot it should automatically run during startup..

After you have tested it..If you might want to run this in command line (stop starting gnome..)..Then this is what i have done.

>>mv /etc/rc2.d/S30gdm /etc/rc2.d/K30gdm

If you want to go to GUI mode..just run startx.


I hope this is useful.

Assumption is that PMS is up and running in GUI mode. You will have to copy the working PMS.conf in PMS_FOLDER as well.
sanju
 
Posts: 19
Joined: Wed Jan 28, 2009 10:31 am

Re: PS3 Media Server as a Linux Service

Postby Nojatron » Mon Feb 09, 2009 12:13 pm

Thanks for that sanju. Much appreciated.
Nojatron
 
Posts: 7
Joined: Sun Feb 08, 2009 12:34 pm

Re: PS3 Media Server as a Linux Service

Postby vmlinuz » Wed Feb 11, 2009 9:21 pm

Good and usefull howto.
You should rename your first post title ;)

[Howto] PS3 Media Server as a Linux Service
CPU Intel Q9550 & RAM 4GB Lan : <100Mb/s wired> Router <100Mb/s> <CPL 200Mb/s @ 160Mb/s >=< 100Mb/s> PS3
old config til Feb 22th : Athlon x64 4200+ oc@2.6Gh RAM 4Gb
vmlinuz
 
Posts: 35
Joined: Mon Jan 19, 2009 10:25 am

Re: PS3 Media Server as a Linux Service

Postby lavvan » Sun Feb 15, 2009 2:10 pm

Hi

Thanx for the init script.

I have an issue though, it seems that when starting at boot the PMS.conf file isn`t used.
If I start it manually it works with my settings, but not on boot. Is there any solution to this? Have I done anything incorrect?
lavvan
 
Posts: 14
Joined: Mon Jan 19, 2009 12:26 am

Re: PS3 Media Server as a Linux Service

Postby sanju » Mon Feb 16, 2009 12:18 pm

Did you modify the PMS.sh as mentioned earlier and also check if you have setup path etc properly ?
sanju
 
Posts: 19
Joined: Wed Jan 28, 2009 10:31 am

Re: PS3 Media Server as a Linux Service

Postby wonslung » Tue Feb 17, 2009 7:52 am

i'm a total newb, could you tell me how to make it work if it's located at /usr/local/sbin/PMS_FOLDER/PMS.sh

i've tried everything i can think of but it keeps telling me it can't find it
-
wonslung
 
Posts: 20
Joined: Tue Feb 17, 2009 7:17 am

Re: PS3 Media Server as a Linux Service

Postby sanju » Tue Feb 17, 2009 6:34 pm

If you see the description..PMS_FOLDER is just a name of the folder where PMS has been un-tared, so in your case, if i understand correctly PMS_FOLDER is
"/usr/local/sbin/PMS_FOLDER/"

So in PMS.sh you should change following line

exec "$JAVA" $JAVA_OPTS -Xmx768M -Djava.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -jar "$PMS_JAR" "$@"

to
cd /usr/local/sbin/PMS_FOLDER/
exec "$JAVA" $JAVA_OPTS -Xmx768M -Djava.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -jar "$PMS_JAR" "$@" &

and in file PS3MediaServerd, PMS_FOLDER should be changed appropriately..

so for e.g. following line in PS3MediaServer
/*********************************************/
DAEMON=PMS_FOLDER/PMS.sh
/*********************************************/

should look like
DAEMON=/usr/local/sbin/PMS_FOLDER/PMS.sh

-sanju.
sanju
 
Posts: 19
Joined: Wed Jan 28, 2009 10:31 am

Next

Return to Linux/Unix Support

Who is online

Users browsing this forum: No registered users and 1 guest