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.
RyLoS wrote:Script updated to 1.2 version, check first post for differences.
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.
#! /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 $?
......
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
........



Users browsing this forum: No registered users and 4 guests