PaulB
My feedback
2 results found
-
26 votes
An error occurred while saving the comment -
4 votes
An error occurred while saving the comment PaulB commentedFor debian, I've got the following init script. I've taken this from some skeleton script and modified it.
Although it does work, there are peculiarities preventing the PID to be recorded at all.
Maybe someone can use it as inspiration and make it fully functional....The complete script uses two files, one for the actual script, and one for configuring it. I will post both as separate comments.
An error occurred while saving the comment PaulB commentedScript file: /etc/init.d/bliss-server
=========================
<pre>#! /bin/sh
# Copyright (C) 2011- by Mar2zz <LaSi.Mar2zz@gmail.com>
# released under GPL, version 2 or later################################################
# #
# TO CONFIGURE EDIT /etc/default/bliss-server #
# #
################################################### BEGIN INIT INFO
# Provides: Bliss server instance
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts instance of Bliss server
# Description: starts instance of Bliss server using start-stop-daemon
### END INIT INFO# main variables
DAEMON=/usr/local/bliss/bin/bliss.sh
SETTINGS=/etc/default/bliss-serverSETTINGS_LOADED=FALSE
DESC='Bliss Server by start-stop-deamon'
# Avoid using root's TMPDIR
unset TMPDIR# only accept values from /etc/default/bliss-server
unset RUN_AS LIBRARY PORT PID_FILE# Source function library.
. /lib/lsb/init-functions# Check that networking is up.
[ -n $NETWORK ] || {
log_warning_msg "$DESC: No network found, aborting. See $DAEMON";
return 1; }
[ -x $DAEMON ] || {
log_warning_msg "$DESC: Can't execute daemon, aborting. See $DAEMON";
return 1; }[ -r $SETTINGS ] || {
log_warning_msg "$DESC: Can't read settings, aborting. See $SETTINGS";
return 1; }check_retval() {
if [ $? -eq 0 ]; then
log_end_msg 0
return 0
else
log_end_msg 1
exit 1
fi
}load_settings() {
if [ $SETTINGS_LOADED != "TRUE" ]; then
. $SETTINGS[ -n "$APP_PATH" ] || {
log_warning_msg "$DESC: path to $DESC not set, aborting. See $SETTINGS";
return 1; }[ $ENABLE_DAEMON = 1 ] || {
log_warning_msg "$DESC: daemon not enabled, aborting. See $SETTINGS";
return 1; }[ -n "$RUN_AS" ] || {
log_warning_msg "$DESC: daemon username not set, aborting. See $SETTINGS";
return 1; }
[ -z "${RUN_AS%:*}" ] && exit 1DAEMON_OPTS="--daemonize"
[ -n "$LIBRARY" ] && DAEMON_OPTS="$DAEMON_OPTS --with-library=$LIBRARY"
[ -n "$PORT" ] && DAEMON_OPTS="$DAEMON_OPTS --port=$PORT"
[ -n "$USERNAME" ] && DAEMON_OPTS="$DAEMON_OPTS --username=$USERNAME"
[ -n "$PASSWORD" ] && DAEMON_OPTS="$DAEMON_OPTS --password=$PASSWORD"
[ -n "$PID_FILE" ] || PID_FILE=/var/run/bliss/bliss-server.pid
DAEMON_OPTS="$DAEMON_OPTS --pidfile=$PID_FILE"
[ $ENABLE_DEVELOPMENT = 1 ] && DAEMON_OPTS="$DAEMON_OPTS --develop"
SETTINGS_LOADED=TRUE
fi
return 0
}load_settings || exit 0
is_running () {
# returns 1 when running, else 0.
PID=$(pgrep -f "$APP_PATH/bin/bliss-server $DAEMON_OPTS")
RET=$?
[ $RET -gt 1 ] && exit 1 || return $RET
}handle_pid () {
PID_PATH=`dirname $PID_FILE`
[ -d $PID_PATH ] || mkdir -p $PID_PATH && chown -R $RUN_AS $PID_PATH > /dev/null || {
log_warning_msg "$DESC: Could not create $PID_FILE, aborting.";
return 1;}
}start_bliss () {
if ! is_running; then
log_daemon_msg "Starting $DESC"
[ "$WEB_UPDATE" = 1 ] && enable_updates
handle_pid
start-stop-daemon -o -c $RUN_AS --start --pidfile $PID_FILE $DEAMON_OPTS --exec $DAEMON -- $EXTRA_OPTS
# /usr/local/bliss/bin/bliss.sh &
check_retval
else
log_success_msg "$DESC: already running (pid $PID)"
fi
}status_bliss () {
if ! is_running; then
log_daemon_msg "$DESC: not running"
else
log_success_msg "$DESC: already running (pid $PID)"
fi
}stop_bliss () {
if is_running; then
log_daemon_msg "Stopping $DESC"
start-stop-daemon -o --stop --pidfile $PID_FILE --retry 15
check_retval
else
log_success_msg "$DESC: not running"
fi
}case "$1" in
start)
start_bliss
;;
stop)
stop_bliss
;;
status)
status_bliss
;;
restart|force-reload)
stop_bliss
start_bliss
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|status|restart|force-reload}" >&2
exit 1
;;
esacexit 0
===================
</pre>An error occurred while saving the comment PaulB commentedConfiguration file: /etc/default/bliss-server
=================================
<pre># This file is sourced by /etc/init.d/bliss-server
#
# When bliss server is started using the init script
# is started under the account of $USER, as set below.
#
# Each setting is marked either "required" or "optional";
# leaving any required setting unconfigured will cause
# the service to not start.# [required] set path where bliss is installed:
APP_PATH=/usr/local/bliss/bin# [optional] change to 1 to enable daemon
ENABLE_DAEMON=1# [required] user or uid of account to run the program as:
RUN_AS=squeezeboxserver# [optional] port number to listen on, defaults to port 3220:
PORT=# [optional] full path for the pidfile
# otherwise, the default location /var/run/bliss/bliss-server.pid is used:
PID_FILE=# [optional] The maximum size for displayed covers. Default is ‘600x800’.
MAX_COVER=# Development mode. Server automatically restarts on file changes and
# serves code files (html, css, js) from the file system instead of
# bliss's resource system. (change to 1 to enable development mode)
DEVELOPMENT=0
ENABLE_DEVELOPMENT=0# [optional] Extra options you want to set. See blissserver --help for more info.
# This needs to be wrapped in quotes "" properly.
EXTRA_OPTS=""===================
</pre>
I think the intention of Tippo is to have a paper catalogue of all your music physically available to look at. I for myself would like to put all the inlays of the CD-boxes in one large book that I can browse.