[INIT SCRIPT] PS3 Media Server Debian/Ubuntu init script

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.

Re: PS3 Media Server Debian/Ubuntu init script

Postby arjaycob » Wed Feb 10, 2010 9:38 am

RyLoS wrote:Script updated to 1.2 version, check first post for differences.

Yeah I actually notice this one. Im using right now the 1.2 version.
arjaycob
 
Posts: 1
Joined: Wed Feb 10, 2010 8:35 am

Re: PS3 Media Server Debian/Ubuntu init script

Postby FoxracR17 » Sat Feb 13, 2010 6:45 am

I cant get this to work on my headless ubuntu 9.10 server. I have followed the directions to the T but the service never starts. Anyone offer any help? What info do you need from me, i'm a linux noob but willing to learn.
FoxracR17
 
Posts: 2
Joined: Fri Feb 12, 2010 6:46 am

Re: PS3 Media Server Debian/Ubuntu init script

Postby paissad » Sat Feb 13, 2010 11:01 am

FoxracR17 wrote:I cant get this to work on my headless ubuntu 9.10 server. I have followed the directions to the T but the service never starts. Anyone offer any help? What info do you need from me, i'm a linux noob but willing to learn.


Hi, threre's an available deb package containing an init.d script , take a look at this topic
viewtopic.php?f=3&t=5589&start=0
User avatar
paissad
 
Posts: 189
Joined: Wed Feb 10, 2010 11:52 pm

Re: PS3 Media Server Debian/Ubuntu init script

Postby RyLoS » Fri Aug 12, 2011 12:24 pm

I've just updated the script. Working well with PID management. Let me know.

Regards

RyLoS
RyLoS
 
Posts: 15
Joined: Wed Mar 04, 2009 3:50 pm

Re: [INIT SCRIPT] PS3 Media Server Debian/Ubuntu init script

Postby Neilos » Tue Aug 23, 2011 10:55 pm

Thanks for the nice job! Works like a charm.
Neilos
 
Posts: 2
Joined: Sun Aug 21, 2011 10:25 pm

Re: [INIT SCRIPT] PS3 Media Server Debian/Ubuntu init script

Postby tmknight » Thu Jan 19, 2012 1:14 am

Great start, but for some reason it wouldn't completely work for me...the service would start but something was breaking in that no files would play. What I ended up with was:
Code: Select all
#! /bin/sh
#source /lib/lsb/init-functions
. /lib/lsb/init-functions
## Variables
DESC="PS3 Media Server"
##logging wasn't working for me (empty files), so removed
#PMS_LOG_TIME=`date +%Y-%d-%m`
#PMS_LOG="/var/log/ps3mediaserver/pms-$PMS_LOG_TIME.log"
##
PMS_HOME="/usr/lib/ps3mediaserver" #explicit path to where you placed PMS binaries
PMS_PROFILE="/someplace/somehwere/PMS.conf" #explicit path to your PMS.conf
NAME="PMS.sh"
DAEMON="$PMS_HOME/$NAME"
PIDFILE="/var/run/ps3mediaserver.pid"

# 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=pmsuser
PMSGROUP=pmsgroup

PATH="$PMS_HOME:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin"
export PATH PMS_HOME PMS_PROFILE

# Exit if the package is not installed
if [ ! -x "$DAEMON" ]; then {
  echo "Couldn't find $DAEMON or not executable"
  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
   if [ -e "$PIDFILE" ]; then {
     log_daemon_msg "$DESC already running or PID file present"
     return 2
   }
   fi

   log_daemon_msg "Starting $DESC"
   start-stop-daemon --background --start --quiet --chdir $PMS_HOME --chuid $PMSUSER:$PMSGROUP --exec $DAEMON --pidfile $PIDFILE --make-pidfile --test > /dev/null || return 1
   start-stop-daemon --background --start --quiet --chdir $PMS_HOME --chuid $PMSUSER:$PMSGROUP --exec $DAEMON --pidfile $PIDFILE --make-pidfile > /dev/null || 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
 ## additional checking/info regarding PMS running or not
  if [ ! -e "$PIDFILE" ]; then {
    log_daemon_msg "$DESC not running or PID file not present"
    return 2
  }
  fi
 ##
  log_daemon_msg "Stopping $DESC"
  start-stop-daemon --stop --signal 2 --retry 5 --quiet --name java --pidfile $PIDFILE
  RETVAL="$?"
  [ "$RETVAL" = 2 ] && return 2
  if [ -e "$PIDFILE" ]; then {
    rm -f $PIDFILE #added force switch
  }
  fi
  return "$RETVAL"
}

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

exit $?

Hope this helps others.

Cheers!
SubJunk Build or Custom from SVN (depends on my mood)
Xubuntu x64 (3.2)
AMD 64 X2 4800+ [OC 2.8GHz]
4GB DDR2
JRE 6 u[latest]
Sony KDL-40W5100
tmknight
 
Posts: 43
Joined: Fri Jan 08, 2010 5:18 pm

Re: [INIT SCRIPT] PS3 Media Server Debian/Ubuntu init script

Postby gelo » Sat Apr 13, 2013 4:29 am

Hi guys, I downloaded the 3.0 version and there is no status returning to the system, so I added the lines:
Code: Select all
......
status)
        status_of_proc -p /var/run/pms.pid $DAEMON PS3MediaServer && exit 0 || exit $?
          ;;
    *)
   echo "Usage: $SCRIPTNAME {start|stop|restart|status}" >&2
   exit 3
   ;;
esac
........


Thx for this script.

And sorry for the English.
Image
Image
Image
gelo
 
Posts: 5
Joined: Thu Jul 29, 2010 12:36 am

Previous

Return to Linux/Unix Support

Who is online

Users browsing this forum: Google [Bot] and 5 guests