PDA

View Full Version : Changes to /etc/init.d/slimserver for SuSE



Jahf
2004-07-28, 09:25
The RPM for slimserver mostly works on my SuSE 8.1 based system
(actually Java Desktop System, based on SuSE Linux Desktop).

However the /etc/init.d/slimserver script never quite worked so I used
to start the server by hand.

I've taken a little time to edit the script. I -believe- it now works as
before on Red Hat systems and definitely now works on my system.

Could someone who has been using /etc/init.d/slimserver with success
from version 5.2.1 doublecheck and see that this works on their system?

I don't know if it works on SuSE 9.x as I don't have the slimserver on
that system right now, so if someone wants to check that, too, cool.

Things that should work on both platforms:

....
# all command options:
/etc/init.d/slimserver start
/etc/init.d/slimserver restart
/etc/init.d/slimserver status
/etc/init.d/slimserver stop

# adding via chkconfig (Fedora has this, right? not sure)
# should add to runlevels 3 and 5 without needing to specify
chkconfig -a slimserver

# deleting via chkconfig
chkconfig -d slimserver

# GUI runlevel editors should also work on both platforms
....

If it works or doesn't, please respond to this thread. If I get reports
of it working on both, it would be cool to have the new version stuck in
the nightlies for further testing and hopefully rolled into production
as it make the RPM truly noarch and compatible with at least these 2
systems.

/Geoff

#!/bin/bash
#
# slimserver.init This shell script takes care of starting and stopping
# the Slim streaming MP3 server.
#
# Info for RedHat / Fedora style init scripts
#
# chkconfig: 345 80 30
# description: Slim streaming MP3 server
# processname: slimserver.pl
# config: /etc/slimserver.conf
#
# The following helps SuSE / UnitedLinux init scripts
# /etc/init.d/slimserver
#
### BEGIN INIT INFO
# Provides: slimserver
# Required-Start: $network
# X-UnitedLinux-Should-Start:
# Required-Stop:
# Default-Start: 3 5
# Default-Stop: 1 2 6
# Description: start the Slim Server
### END INIT INFO


# Are we Red Hat/Fedora or SuSE?
if [ -f /etc/SuSE-release ]; then
SUSE=1
DAEMON='start_daemon -u'
else
REDHAT=1
DAEMON='daemon --user'
fi

if [ $REDHAT ]; then
echo "... detected Red Hat / Fedora style distro ..."
# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
if [ -f /etc/sysconfig/network ]; then
. /etc/sysconfig/network
fi

# Networking check is different for SuSE, so moved the check here
# Check that networking is up for Red Hat
[ ${NETWORKING} = "no" ] && exit 0
fi

if [ $SUSE ]; then
echo "... detected SuSE style distro ..."
# Source rc status functions
. /etc/rc.status

# Source networking functions
. /etc/sysconfig/network/scripts/functions

# check if networking is up, not counting localhost
if [ ! `get_active_ifaces | grep -v 'lo'` ]; then
exit 0
fi
fi

# We do this regardless of distro
if [ -f /etc/sysconfig/slimserver ]; then
. /etc/sysconfig/slimserver
fi


RETVAL=0
prog="SLIMSERVER"

SLIMSERVER_BIN="$SLIMSERVER_HOME/slimserver.pl"

[ -x $SLIMSERVER_BIN -a -f $SLIMSERVER_CFG ] || exit 5

start() {
echo -n "Starting SlimServer: "
$DAEMON $SLIMSERVER_USER $SLIMSERVER_BIN $SLIMSERVER_ARGS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/slimserver
return $RETVAL
# echo_success
}

stop() {
echo -n "Shutting down SlimServer: "
killproc $SLIMSERVER_BIN
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/slimserver
return $RETVAL
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
RETVAL=$?
;;
status)
if [ $REDHAT ]; then
status $SLIMSERVER_BIN
RETVAL=$?
fi
if [ $SUSE ]; then
rc_status -v
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit $RETVAL

Victor Brilon
2004-07-28, 17:49
Geoff,

This looks very cool. Any chance you could make a diff of the changes
you created against the current CVS? I'd like to make sure that nothing
in there would inadvertantly break the RH startup scripts.

Victor

Jahf wrote:
> The RPM for slimserver mostly works on my SuSE 8.1 based system
> (actually Java Desktop System, based on SuSE Linux Desktop).
>
> However the /etc/init.d/slimserver script never quite worked so I used
> to start the server by hand.
>
> I've taken a little time to edit the script. I -believe- it now works as
> before on Red Hat systems and definitely now works on my system.
>
> Could someone who has been using /etc/init.d/slimserver with success
> from version 5.2.1 doublecheck and see that this works on their system?
>
> I don't know if it works on SuSE 9.x as I don't have the slimserver on
> that system right now, so if someone wants to check that, too, cool.
>
> Things that should work on both platforms:
>
> ...
> # all command options:
> /etc/init.d/slimserver start
> /etc/init.d/slimserver restart
> /etc/init.d/slimserver status
> /etc/init.d/slimserver stop
>
> # adding via chkconfig (Fedora has this, right? not sure)
> # should add to runlevels 3 and 5 without needing to specify
> chkconfig -a slimserver
>
> # deleting via chkconfig
> chkconfig -d slimserver
>
> # GUI runlevel editors should also work on both platforms
> ...
>
> If it works or doesn't, please respond to this thread. If I get reports
> of it working on both, it would be cool to have the new version stuck in
> the nightlies for further testing and hopefully rolled into production
> as it make the RPM truly noarch and compatible with at least these 2
> systems.
>
> /Geoff
>
>
> ------------------------------------------------------------------------
>
> #!/bin/bash
> #
> # slimserver.init This shell script takes care of starting and stopping
> # the Slim streaming MP3 server.
> #
> # Info for RedHat / Fedora style init scripts
> #
> # chkconfig: 345 80 30
> # description: Slim streaming MP3 server
> # processname: slimserver.pl
> # config: /etc/slimserver.conf
> #
> # The following helps SuSE / UnitedLinux init scripts
> # /etc/init.d/slimserver
> #
> ### BEGIN INIT INFO
> # Provides: slimserver
> # Required-Start: $network
> # X-UnitedLinux-Should-Start:
> # Required-Stop:
> # Default-Start: 3 5
> # Default-Stop: 1 2 6
> # Description: start the Slim Server
> ### END INIT INFO
>
>
> # Are we Red Hat/Fedora or SuSE?
> if [ -f /etc/SuSE-release ]; then
> SUSE=1
> DAEMON='start_daemon -u'
> else
> REDHAT=1
> DAEMON='daemon --user'
> fi
>
> if [ $REDHAT ]; then
> echo "... detected Red Hat / Fedora style distro ..."
> # Source function library.
> . /etc/rc.d/init.d/functions
>
> # Source networking configuration.
> if [ -f /etc/sysconfig/network ]; then
> . /etc/sysconfig/network
> fi
>
> # Networking check is different for SuSE, so moved the check here
> # Check that networking is up for Red Hat
> [ ${NETWORKING} = "no" ] && exit 0
> fi
>
> if [ $SUSE ]; then
> echo "... detected SuSE style distro ..."
> # Source rc status functions
> . /etc/rc.status
>
> # Source networking functions
> . /etc/sysconfig/network/scripts/functions
>
> # check if networking is up, not counting localhost
> if [ ! `get_active_ifaces | grep -v 'lo'` ]; then
> exit 0
> fi
> fi
>
> # We do this regardless of distro
> if [ -f /etc/sysconfig/slimserver ]; then
> . /etc/sysconfig/slimserver
> fi
>
>
> RETVAL=0
> prog="SLIMSERVER"
>
> SLIMSERVER_BIN="$SLIMSERVER_HOME/slimserver.pl"
>
> [ -x $SLIMSERVER_BIN -a -f $SLIMSERVER_CFG ] || exit 5
>
> start() {
> echo -n "Starting SlimServer: "
> $DAEMON $SLIMSERVER_USER $SLIMSERVER_BIN $SLIMSERVER_ARGS
> RETVAL=$?
> echo
> [ $RETVAL -eq 0 ] && touch /var/lock/subsys/slimserver
> return $RETVAL
> # echo_success
> }
>
> stop() {
> echo -n "Shutting down SlimServer: "
> killproc $SLIMSERVER_BIN
> RETVAL=$?
> echo
> [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/slimserver
> return $RETVAL
> }
>
> # See how we were called.
> case "$1" in
> start)
> start
> ;;
> stop)
> stop
> ;;
> restart|reload)
> stop
> start
> RETVAL=$?
> ;;
> status)
> if [ $REDHAT ]; then
> status $SLIMSERVER_BIN
> RETVAL=$?
> fi
> if [ $SUSE ]; then
> rc_status -v
> fi
> ;;
> *)
> echo "Usage: $0 {start|stop|restart|status}"
> exit 1
> esac
> exit $RETVAL
>
>
> ------------------------------------------------------------------------
>
>

Geoff
2004-07-30, 15:22
Victor Brilon wrote:
> Geoff,
>
> This looks very cool. Any chance you could make a diff of the changes
> you created against the current CVS? I'd like to make sure that nothing
> in there would inadvertantly break the RH startup scripts.
>
> Victor

Hopefully diff'ing the nightly from yesterday will do :) It is attached.

I haven't gotten any "works on redhat/fedora" confirmations ... once I
do, what is the process for getting it into a nightly for checking?

Also, I think the RPM spec file may be a bit SuSE unfriendly ... I
installed a fresh OS last night (not by choice, long story) and when I
installed Slimserver (7/30 nightly) it made a directory called
"/etc/init.d/init.d" and put 'slimserver' in there. I'm -assuming- that
RH/Fedora don't have a /etc/init.d/init.d directory, and that it should
always go in /etc/init.d ... is there a way for me to see the .spec file?

/Geoff

Geoff
2004-07-30, 15:22
Victor Brilon wrote:
> Geoff,
>
> This looks very cool. Any chance you could make a diff of the changes
> you created against the current CVS? I'd like to make sure that nothing
> in there would inadvertantly break the RH startup scripts.
>
> Victor

Hopefully diff'ing the nightly from yesterday will do :) It is attached.

I haven't gotten any "works on redhat/fedora" confirmations ... once I
do, what is the process for getting it into a nightly for checking?

Also, I think the RPM spec file may be a bit SuSE unfriendly ... I
installed a fresh OS last night (not by choice, long story) and when I
installed Slimserver (7/30 nightly) it made a directory called
"/etc/init.d/init.d" and put 'slimserver' in there. I'm -assuming- that
RH/Fedora don't have a /etc/init.d/init.d directory, and that it should
always go in /etc/init.d ... is there a way for me to see the .spec file?

/Geoff

Victor Brilon
2004-07-30, 17:01
Geoff,


Geoff wrote:
> I haven't gotten any "works on redhat/fedora" confirmations ... once I
> do, what is the process for getting it into a nightly for checking?

Dean is the guys who ok's the changes and checks them in.

> is there a way for me to see the .spec file?

If you're looking in the nightly CVS, it's under
platforms/redhat/slimserver.spec.build

Victor

Geoff
2004-08-19, 09:10
Minor change ... missing the "" around the interface test results caused
an error message. It worked, but now it works without the error.


Victor Brilon wrote:
> Geoff,
>
>
> Geoff wrote:
>
>> I haven't gotten any "works on redhat/fedora" confirmations ... once I
>> do, what is the process for getting it into a nightly for checking?
>
>
> Dean is the guys who ok's the changes and checks them in.
>
>> is there a way for me to see the .spec file?
>
>
> If you're looking in the nightly CVS, it's under
> platforms/redhat/slimserver.spec.build
>
> Victor


#!/bin/bash
#
# slimserver.init This shell script takes care of starting and stopping
# the Slim streaming MP3 server.
#
# Info for RedHat / Fedora style init scripts
#
# chkconfig: 345 80 30
# description: Slim streaming MP3 server
# processname: slimserver.pl
# config: /etc/slimserver.conf
#
# The following helps SuSE / UnitedLinux init scripts
# /etc/init.d/slimserver
#
### BEGIN INIT INFO
# Provides: slimserver
# Required-Start: $network
# X-UnitedLinux-Should-Start:
# Required-Stop:
# Default-Start: 3 5
# Default-Stop: 1 2 6
# Description: start the Slim Server
### END INIT INFO


# Are we Red Hat/Fedora or SuSE?
if [ -f /etc/SuSE-release ]; then
SUSE=1
DAEMON='start_daemon -u'
else
REDHAT=1
DAEMON='daemon --user'
fi

if [ $REDHAT ]; then
echo "... detected Red Hat / Fedora style distro ..."
# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
if [ -f /etc/sysconfig/network ]; then
. /etc/sysconfig/network
fi

# Networking check is different for SuSE, so moved the check here
# Check that networking is up for Red Hat
[ ${NETWORKING} = "no" ] && exit 0
fi

if [ $SUSE ]; then
echo "... detected SuSE style distro ..."
# Source rc status functions
. /etc/rc.status

# Source networking functions
. /etc/sysconfig/network/scripts/functions

# check if networking is up, not counting localhost
if [ ! "`get_active_ifaces | /bin/grep -v 'lo'`" ]; then
exit 0
fi
fi

# We do this regardless of distro
if [ -f /etc/sysconfig/slimserver ]; then
. /etc/sysconfig/slimserver
fi


RETVAL=0
prog="SLIMSERVER"

SLIMSERVER_BIN="$SLIMSERVER_HOME/slimserver.pl"

[ -x $SLIMSERVER_BIN -a -f $SLIMSERVER_CFG ] || exit 5

start() {
echo -n "Starting SlimServer: "
$DAEMON $SLIMSERVER_USER $SLIMSERVER_BIN $SLIMSERVER_ARGS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/slimserver
return $RETVAL
# echo_success
}

stop() {
echo -n "Shutting down SlimServer: "
killproc $SLIMSERVER_BIN
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/slimserver
return $RETVAL
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
RETVAL=$?
;;
status)
if [ $REDHAT ]; then
status $SLIMSERVER_BIN
RETVAL=$?
fi
if [ $SUSE ]; then
rc_status -v
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit $RETVAL

Chop Chop
2005-12-22, 03:16
Small compatibility message: this script also works on SuSE 10 :)

swissboy68
2005-12-24, 07:17
on suse linux 10.0 i have the following error message:
"get_active_ifaces: command not found"
and the slimserver starters not.
which I have made wrong? otherwise no problems with the system exist.

richard from switzerland

mherger
2005-12-25, 03:37
Richard

> on suse linux 10.0 i have the following error message:

As far as I know the rpm doesn't work for suse without manual changes.
Please have a look at the wiki
(http://wiki.slimdevices.com/index.cgi?SUSE93StartupScripts) - this is for
suse 9.3, but it might help with 10, too.

Greetings from your beloved neighbouring canton Aargau ;-)

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
StringEditor Plugin (http://www.herger.net/slim/)

swissboy68
2005-12-26, 02:20
danke michale

dies funktioniert. nun kann ich weiter üben.

de richard us em aargovialand

jwachter
2006-02-19, 13:18
I recently install a new suse system. I then attempted to use the rpm to install the slimserver. it mostly works. I can start the server from the /usr/local/bin directory, however the suse 9.3 just doesn't work. Can anyone give me a 10 /etc/init.d/slimserver script and sysconfig file?

mooler
2007-01-14, 07:07
Me to get an error on get_active_ifaces

Did check the link
http://wiki.slimdevices.com/index.cgi?SUSE93StartupScripts
but that didn't help me much.

What did you do swissboy68 to get it working?

My error is
"./slimserver: line 15: .: /etc/sysconfig/network: is a directory
./slimserver: line 22: get_active_ifaces: command not found
"

*edit* I'm using SuSE 10.2

Mark Miksis
2007-01-14, 10:12
Have you tried this one?

http://wiki.slimdevices.com/index.cgi?SUSE101StartupScripts