subsonic stops working daily on ReadyNAS because of this.

Need help? Post your questions here.

Moderator: moderators

subsonic stops working daily on ReadyNAS because of this.

Postby pkas » Fri Sep 21, 2012 11:21 am

I have an ReadyNAS Ultra 4+, and I have the subsonic server running on it. Everything worked great until a few days ago -- I can't be sure, though, if what I am about to describe only started after I upgraded the subsonic server from 4.7.02 to 4.7.03.

Every morning the subsonic service is no longer running. It turns out, that the readyNAS has a daily cron job -- and the service stops as a result of the cron job. I walked though the daily cron, and found that this one command causes the subsonic service to stop:

start-stop-daemon -K -n apache-ssl -R 5; /usr/sbin/apache-ssl -f /etc/frontview/apache/httpd.conf

The above line has two commands; the first command (start-stop-daemon -K -n apache-ssl -R 5) is what causes the subsonic service to stop.

Here's how I am working around the problem. You need to be able to ssh into the ReadyNAS, as root, so that you can modify /etc/cron.daily/logtruncate. Find the following lines in /etc/cron.daily/logtruncate:

Code: Select all
foreach my $cmd (keys %restart) {
  system("$cmd");
}


Put the following lines BEFORE the above lines:

Code: Select all
my $subsonic = `ps aux | grep onic | grep jar | grep -v grep | sed -r -e 's/ +/ /g' | cut -f 11- -d ' '`; # PKAS
chomp($subsonic); # PKAS


And put the following lines after the original lines:

Code: Select all
my $isSubsonicStillThere =  `ps aux | grep onic | grep jar | grep -v grep`; # PKAS
if ($subsonic && $isSubsonicStillThere !~ /jar/) { # PKAS
  print "Restarting subsonic\n"; # PKAS
  system("cd /c/webroot/subsonic \&\& rm -f nohup.out \&\& nohup $subsonic 2>\&1 >/dev/null \&"); # PKAS
} # PKAS


In the end, this is what the section of code should look like:
Code: Select all
my $subsonic = `ps aux | grep onic | grep jar | grep -v grep | sed -r -e 's/ +/ /g' | cut -f 11- -d ' '`; # PKAS
chomp($subsonic); # PKAS

foreach my $cmd (keys %restart) {
  system("$cmd");
}
my $isSubsonicStillThere =  `ps aux | grep onic | grep jar | grep -v grep`; # PKAS
if ($subsonic && $isSubsonicStillThere !~ /jar/) { # PKAS
  print "Restarting subsonic\n"; # PKAS
  system("cd /c/webroot/subsonic \&\& rm -f nohup.out \&\& nohup $subsonic 2>\&1 >/dev/null \&"); # PKAS
} # PKAS


I considered alternative approaches - such as just adding a cron job to see if subsonic is still running, regardless of why it stops. I might switch to that approach, because it would decouple the logtruncate script from subsonic, but for now the above approach is what I am using.

Phil
pkas
 
Posts: 2
Joined: Sat Aug 11, 2012 1:06 pm

Return to Help

Who is online

Users browsing this forum: No registered users and 6 guests