Bug 17730 - Server daemonizes repeatedly when restarting
: Server daemonizes repeatedly when restarting
Status: RESOLVED DUPLICATE of bug 17729
Product: Logitech Media Server
Classification: Unclassified
Component: Misc
: 7.6.2
: PC Linux (other)
: P3 normal with 1 vote (vote)
: 7.8.0
Assigned To: Michael Herger
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-11-05 12:11 UTC by quiet.dragon
Modified: 2012-03-20 04:27 UTC (History)
0 users

See Also:
Category: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description quiet.dragon 2011-11-05 12:11:11 UTC
In sub stopServer, the server passes the --daemon flag on to its restarted version, and daemonizes again confusingly and unnecessarily:


--- slimserver.pl.orig  2011-08-27 02:00:18.000000000 -0700
+++ slimserver.pl       2011-11-05 12:06:56.000000000 -0700
@@ -1074,6 +1074,7 @@
                && Slim::Utils::OSDetect->getOS()->canRestartServer()
                && !main::ISWINDOWS)
        {
+               @argv = grep { $_ ne '--daemon' } @argv;
                exec($^X, $0, @argv);
        }


An alternate approach might be to strip --deamon from the command line after daemonizing. This is already done for Darwin:


--- slimserver.pl.orig  2011-08-27 02:00:18.000000000 -0700
+++ slimserver.pl       2011-11-05 12:10:19.000000000 -0700
@@ -917,10 +917,12 @@

        open STDOUT, '>>/dev/null';

+       # Do not attempt to daemonize again.
+       @argv = grep { $_ ne '--daemon' } @argv;
+
        # On Leopard, GD will crash because you can't run CoreServices code in a forked child,
        # so we have to exec as well.
        if ( $^O =~ /darwin/ ) {
-               @argv = grep { $_ ne '--daemon' } @argv;
                exec $^X . ' "' . $0 . '" ' . join( ' ', @argv );
                exit;
        }
Comment 1 Michael Herger 2012-03-20 04:27:08 UTC
Fixed as a side effect of cleanup done in 17729. r33893

*** This bug has been marked as a duplicate of bug 17729 ***