2022-12-24 Fred Gleason <fredg@paravelsystems.com>

* Added a 'ServiceStartDelay=' directive to the '[Tuning]' section
	of rd.conf(5).
	* Added 'sound.target' to the 'After=' directive in
	'systemd/rivendell.service.in'.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2022-12-24 11:15:48 -05:00
parent eb3cf2f127
commit b59e3b8479
8 changed files with 64 additions and 4 deletions

View File

@ -23863,3 +23863,8 @@
* Incremented the version of the 'rivwebpyapi' PyPI package to * Incremented the version of the 'rivwebpyapi' PyPI package to
4.0.0b4. 4.0.0b4.
* Incremented the package version to 4.0.0rc0int12. * Incremented the package version to 4.0.0rc0int12.
2022-12-24 Fred Gleason <fredg@paravelsystems.com>
* Added a 'ServiceStartDelay=' directive to the '[Tuning]' section
of rd.conf(5).
* Added 'sound.target' to the 'After=' directive in
'systemd/rivendell.service.in'.

View File

@ -176,6 +176,11 @@ TranscodingDelay=0
; then '/tmp' will be used. ; then '/tmp' will be used.
;TempDirectory=/tmp ;TempDirectory=/tmp
; Seconds to wait before rdservice(8) launches the caed(8) daemon. Needed
; in some setups to allow other subsystems --e.g. ALSA -- to stabilize after
; bootup.
;ServiceStartupDelay=5
[Hacks] [Hacks]
; Completely disable maintenance checks on this host. ; Completely disable maintenance checks on this host.
; DisableMaintChecks=Yes ; DisableMaintChecks=Yes

View File

@ -6,7 +6,7 @@
<refmeta> <refmeta>
<refentrytitle>rd.conf</refentrytitle> <refentrytitle>rd.conf</refentrytitle>
<manvolnum>5</manvolnum> <manvolnum>5</manvolnum>
<refmiscinfo class='source'>October 2019</refmiscinfo> <refmiscinfo class='source'>December 2022</refmiscinfo>
<refmiscinfo class='manual'>Linux Audio Manual</refmiscinfo> <refmiscinfo class='manual'>Linux Audio Manual</refmiscinfo>
</refmeta> </refmeta>
<refnamediv> <refnamediv>
@ -715,6 +715,21 @@
aspects of Rivendell. aspects of Rivendell.
</para> </para>
<variablelist> <variablelist>
<varlistentry>
<term>
<userinput>ServiceStartDelay = <replaceable>secs</replaceable></userinput>
</term>
<listitem>
<para>
Instruct <command>rdservice</command><manvolnum>8</manvolnum>
to wait for <replaceable>secs</replaceable> seconds before
initiating service startup. Useful for giving certain
subsystems --e.g. ALSA -- time to reach a stable state during
system bootup (but see BUGS below). Default value is
<userinput>5</userinput>.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<userinput>ServiceTimeout = <replaceable>secs</replaceable></userinput> <userinput>ServiceTimeout = <replaceable>secs</replaceable></userinput>
@ -867,6 +882,15 @@
</variablelist> </variablelist>
</refsect1> </refsect1>
<refsect1 id='bugs'><title>Bugs</title>
<para>
In a perfect world, the <userinput>ServiceStartDelay=</userinput> parameter
would not be required. It is present to work around shortcomings in
<command>systemd</command><manvolnum>1</manvolnum>'s
<userinput>sound.target</userinput> service synchronization.
</para>
</refsect1>
<refsect1 id='see_also'><title>See Also</title> <refsect1 id='see_also'><title>See Also</title>
<para> <para>
<citerefentry> <citerefentry>

View File

@ -626,6 +626,11 @@
*/ */
#define RD_DEFAULT_SERVICE_TIMEOUT 30 #define RD_DEFAULT_SERVICE_TIMEOUT 30
/*
* Default 'ServiceStartupDelay=' value in rd.conf(5) [seconds]
*/
#define RD_DEFAULT_SERVICE_STARTUP_DELAY 5
/* /*
* File Extension for RSS XML Feed Files * File Extension for RSS XML Feed Files
*/ */

View File

@ -519,6 +519,13 @@ QString RDConfig::tempDirectory()
return conf_temp_directory; return conf_temp_directory;
} }
int RDConfig::serviceStartupDelay() const
{
return conf_service_startup_delay;
}
QString RDConfig::sasStation() const QString RDConfig::sasStation() const
{ {
return conf_sas_station; return conf_sas_station;
@ -706,6 +713,8 @@ bool RDConfig::load()
conf_service_timeout= conf_service_timeout=
profile->intValue("Tuning","ServiceTimeout",RD_DEFAULT_SERVICE_TIMEOUT); profile->intValue("Tuning","ServiceTimeout",RD_DEFAULT_SERVICE_TIMEOUT);
conf_temp_directory=profile->stringValue("Tuning","TempDirectory",""); conf_temp_directory=profile->stringValue("Tuning","TempDirectory","");
conf_service_startup_delay=profile->intValue("Tuning","ServiceStartupDelay",
RD_DEFAULT_SERVICE_STARTUP_DELAY);
conf_sas_station=profile->stringValue("SASFilter","Station",""); conf_sas_station=profile->stringValue("SASFilter","Station","");
conf_sas_matrix=profile->intValue("SASFilter","Matrix",0); conf_sas_matrix=profile->intValue("SASFilter","Matrix",0);
conf_sas_base_cart=profile->intValue("SASFilter","BaseCart",0); conf_sas_base_cart=profile->intValue("SASFilter","BaseCart",0);
@ -820,6 +829,7 @@ void RDConfig::clear()
conf_transcoding_delay=0; conf_transcoding_delay=0;
conf_service_timeout=RD_DEFAULT_SERVICE_TIMEOUT; conf_service_timeout=RD_DEFAULT_SERVICE_TIMEOUT;
conf_temp_directory=""; conf_temp_directory="";
conf_service_startup_delay=RD_DEFAULT_SERVICE_STARTUP_DELAY;
conf_sas_station=""; conf_sas_station="";
conf_sas_matrix=-1; conf_sas_matrix=-1;
conf_sas_base_cart=1; conf_sas_base_cart=1;

View File

@ -25,8 +25,8 @@
#include <vector> #include <vector>
#include <qhostaddress.h> #include <QHostAddress>
#include <qstring.h> #include <QString>
#include <rd.h> #include <rd.h>
@ -123,6 +123,7 @@ class RDConfig
int transcodingDelay() const; int transcodingDelay() const;
int serviceTimeout() const; int serviceTimeout() const;
QString tempDirectory(); QString tempDirectory();
int serviceStartupDelay() const;
QString sasStation() const; QString sasStation() const;
int sasMatrix() const; int sasMatrix() const;
unsigned sasBaseCart() const; unsigned sasBaseCart() const;
@ -208,6 +209,7 @@ class RDConfig
int conf_realtime_priority; int conf_realtime_priority;
int conf_service_timeout; int conf_service_timeout;
QString conf_temp_directory; QString conf_temp_directory;
int conf_service_startup_delay;
QString conf_sas_station; QString conf_sas_station;
int conf_sas_matrix; int conf_sas_matrix;
unsigned conf_sas_base_cart; unsigned conf_sas_base_cart;

View File

@ -120,6 +120,15 @@ MainObject::MainObject(QObject *parent)
} }
} }
//
// Startup Delay
//
if(rda->config()->serviceStartupDelay()>0) {
rda->syslog(LOG_INFO,"delaying startup for %d seconds",
rda->config()->serviceStartupDelay());
sleep(rda->config()->serviceStartupDelay()); // Blunt object, but it works!
}
// //
// Exit Timer // Exit Timer
// //

View File

@ -2,7 +2,7 @@
[Unit] [Unit]
Description=Rivendell Radio Automation System Description=Rivendell Radio Automation System
After=network.target remote-fs.target nss-lookup.target After=network.target remote-fs.target nss-lookup.target sound.target
[Service] [Service]
LimitNOFILE=4096 LimitNOFILE=4096