]> git.ktnx.net Git - mpd-feeder.git/commitdiff
dump configuration to STDERR on SIGUSR1
authorDamyan Ivanov <dmn@debian.org>
Thu, 11 Nov 2021 14:46:46 +0000 (14:46 +0000)
committerDamyan Ivanov <dmn@debian.org>
Thu, 11 Nov 2021 14:46:46 +0000 (14:46 +0000)
bin/mpd-feeder

index da60df88a227312970e952c9f4506ecebf33ac2b..d6f5d6ff3fc423def3e9efd770065da1fdada33a 100755 (executable)
@@ -180,6 +180,22 @@ use Net::Async::MPD;
                 },
             )
         );
+
+        $mpd->loop->add(
+            IO::Async::Signal->new(
+                name       => 'USR1',
+                on_receipt => sub {
+                    $log->debug("SIGUSR1 received. Dumping configuration to STDERR");
+                    my $old = select \*STDERR;
+                    try {
+                        $opt->dump;
+                    }
+                    finally {
+                        select $old;
+                    }
+                },
+            )
+        );
     }
 
     method connect_db {