PDA

View Full Version : Automatically restart crashed slimserver?



mecouc
2005-09-05, 02:54
I hardly ever use my squeezebox these days, because the server software crashes so frequently, mostly when I use internet radio. I got fed up running up stairs 3 or 4 times an evening to restart it.

Is there a way (with Windows XP SP2) to automatically restart the server? I imagine it should be easy to do for a programmer, which I'm not. All you'd need to do is check every 10 seconds whether there's a slim.exe process running, and if not, start it.

I've downloaded updated software repeatedly, and and the problem hasn't really gone away, and it's continued with a rebuilt PC. A workaround looks like the best bet... is there something out there I coudl use?

max.spicer
2005-09-05, 04:58
Right-click My Computer and select Manage. Expand Services & Applications and click Services. Find the SlimServer service (don't know what it's called), right-click it and select Properties. Click the Recovery tab and set it as you want it.

This is a guess, as I don't run SlimServer on Windows. However, assuming it runs as a service, these instructions should apply.

Max

stuorguk
2005-09-05, 04:59
4 times a night! Thats ridiculous.... Surly it would be better to try and find out whats causing the problem first. Can't remember the last time mine crashed. Try switching on the debug mode to see if it gives any clues. Have you got some virus/firewall software maybe thats perhaps causing problems? Is ther server used for anything else? Is switching to Linux an option?

mecouc
2005-09-05, 06:55
Thanks for the suggestions. I'll give them a go.

Unfortunately I no longer have time to mess about trying to find out why it doesn't work - either it works or I don't use it, and when I've finished work for the day I don't want to spend any more time looking at my PC!

robinbowes
2005-09-05, 07:45
This is of no help at all to the OP, but this thread has given me the impetus to get slimserver working with djb's daemontools (http://cr.yp.to/daemontools.html).

Here's what I did.

1. Create a directory for the service and the log:

# mkdir -p /etc/slimdata/service/log

2. Create the slimserver run file:

# vi /etc/slimdata/service/run

#!/bin/sh

SLIMSERVER_HOME='/usr/local/slimserver'
SLIMSERVER_BIN="${SLIMSERVER_HOME}/slimserver.pl"
SLIMSERVER_CFG='/etc/slimdata/slimserver.conf'
SLIMSERVER_USER='slimserver'
SLIMSERVER_ARGS="--prefsfile=${SLIMSERVER_CFG}"
LC_CTYPE=en_GB.ISO-8859-1

exec /usr/local/bin/setuidgid $SLIMSERVER_USER $SLIMSERVER_BIN $SLIMSERVER_ARGS 2>&1

3. Create the log run file:

# vi /etc/slimdata/service/log/run

#! /bin/sh
LOGDIR=/var/log/slimserver
exec /usr/local/bin/setuidgid slimserver multilog n20 s10485760 $LOGDIR

4. Make both run files executable:

# chmod +x /etc/slimdata/service/run
# chmod +x /etc/slimdata/service/log/run

5. Set permissions on whole service directory:

# chown -R slimserver:slimserver /etc/slimdata/service

6. Create the log dir:

# mkdir /var/log/slimserver

7. Set permissions on log dir:

# chown slimserver:slimserver /var/log/slimserver

8. Stop slimserver (run from init.d):

# service slimserver stop

8. Start the new service:

# cd /service
# ln -s /etc/slimdata/service slimserver

9. Check it's running:

# svstat /service/slimserver/ /service/slimserver/log
/service/slimserver/: up (pid 21223) 506 seconds
/service/slimserver/log: up (pid 21002) 954 seconds

10. Remove the service from init.d permanently;

# chkconfig --del slimserver
# chkconfig --list slimserver
service slimserver supports chkconfig, but is not referenced
in any runlevel (run 'chkconfig --add slimserver')

Notice I have not used the "t" option in the multilog line (timestamp). This is because most (not all) slimserver output is already timestamped. It would be better (for this application anyhow) to turn off slimserver timestamping and to turn on multilog timestamping. That would ensure that *all* output is timestamped, even plug-in output.

I hope someone else finds this useful.

R.

stinkingpig
2005-09-05, 15:22
robinbowes wrote:

>This is of no help at all to the OP, but this thread has given me the
>impetus to get slimserver working with djb's daemontools
>(http://cr.yp.to/daemontools.html).
>
>
.... only thing I use out of daemontools is setuidgid, which is really
handy (though I should probably just be using a chroot jail wherever I'm
using it :))

Anyway, my solution for this was to add a Nagios event_handler. I
already have Nagios running on the same box as Slimserver, so I just had
to edit two files.

/etc/nagios/services.cfg
define service {
use generic-service ; Name
of template
host_name felix
service_description Slimserver
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 15
retry_check_interval 5
event_handler restart_slimserver
contact_groups me
notification_interval 120
notification_period 24x7
notification_options w,c,r
check_command check_http!localhost!9000
}

/etc/nagios/misccommands.cfg
define command{
command_name restart_slimserver
command_line
/usr/lib/nagios/plugins/eventhandlers/restart_service $SERVICESTATE$
$SERVICESTATETYPE$ $SERVICEATTEMPT$ slimserver
}

--
Jack at Monkeynoodle dot Org : It's a Scientific Venture!
"I spent all me tin with the ladies drinking gin,
so across the Western ocean I must wander." -- All for Me Grog, traditional

Robin Bowes
2005-09-05, 15:33
Jack Coates said the following on 05/09/2005 23:22:
> robinbowes wrote:
>
>> This is of no help at all to the OP, but this thread has given me the
>> impetus to get slimserver working with djb's daemontools
>> (http://cr.yp.to/daemontools.html).
>>
>>
> ... only thing I use out of daemontools is setuidgid

Why's that? supervise, svc, multilog, all really useful tools.

> which is really
> handy (though I should probably just be using a chroot jail wherever I'm
> using it :))
>
> Anyway, my solution for this was to add a Nagios event_handler. I
> already have Nagios running on the same box as Slimserver, so I just had
> to edit two files.

I've not seen Nagios before, but it's not really the same sort of thing
as daemontools.

Looks quite neat, though.

R.
--
http://robinbowes.com

If a man speaks in a forest,
and his wife's not there,
is he still wrong?

stinkingpig
2005-09-05, 16:16
Robin Bowes wrote:

> Jack Coates said the following on 05/09/2005 23:22:
>
>> robinbowes wrote:
>>
>>> This is of no help at all to the OP, but this thread has given me the
>>> impetus to get slimserver working with djb's daemontools
>>> (http://cr.yp.to/daemontools.html).
>>>
>>>
>> ... only thing I use out of daemontools is setuidgid
>
>
> Why's that? supervise, svc, multilog, all really useful tools.
>

They've alway struck me as an attempt to reimplement SysV init scripts
for distros that don't do SysV. I haven't missed their functionality.

> > which is really
>
>> handy (though I should probably just be using a chroot jail wherever
>> I'm using it :))
>>
>> Anyway, my solution for this was to add a Nagios event_handler. I
>> already have Nagios running on the same box as Slimserver, so I just
>> had to edit two files.
>
>
> I've not seen Nagios before, but it's not really the same sort of
> thing as daemontools.
>
> Looks quite neat, though.
>
> R.


Nagios is up there with Slimserver in coolness. Nagios can be tough to
configure, but it's amazingly flexible and really quite smart. A glowing
example of open source software that beats the pants off of commercial
alternatives.

--
Jack at Monkeynoodle dot Org : It's a Scientific Venture!
"I spent all me tin with the ladies drinking gin,
so across the Western ocean I must wander." -- All for Me Grog, traditional

Robin Bowes
2005-09-05, 23:18
Jack Coates said the following on 06/09/2005 00:16:
> Robin Bowes wrote:
>>
>> Why's that? supervise, svc, multilog, all really useful tools.
>
> They've alway struck me as an attempt to reimplement SysV init scripts
> for distros that don't do SysV. I haven't missed their functionality.

No, they do more than that.

SysV init scripts just launch a service when you enter a particular run
level (and stop it when you leave, possibly).

supervise starts and monitors a service, i.e. if the service dies for
whatever reason supervise re-launches it pretty much immediately.

svc is just a tools to control supervise'd services.

multilog is a more reliable way to log than syslog.

>> I've not seen Nagios before, but it's not really the same sort of
>> thing as daemontools.
>>
>> Looks quite neat, though.
>
> Nagios is up there with Slimserver in coolness. Nagios can be tough to
> configure, but it's amazingly flexible and really quite smart. A glowing
> example of open source software that beats the pants off of commercial
> alternatives.

I'll maybe check it out some time when I've got a minute (yeah, right!)

R.
--
http://robinbowes.com

If a man speaks in a forest,
and his wife's not there,
is he still wrong?

Philip Meyer
2005-09-06, 13:24
>Right-click My Computer and select Manage. Expand Services &
>Applications and click Services. Find the SlimServer service (don't
>know what it's called), right-click it and select Properties. Click
>the Recovery tab and set it as you want it.
>
>This is a guess, as I don't run SlimServer on Windows. However,
>assuming it runs as a service, these instructions should apply.
>
I have done this in the past. However, unfortunately whenever upgrading the server to a new release, the service settings are reset.

It would be nice if the windows installer could retain the service configuration settings. Is that possible?

Phil