Skip to content

Commit

Permalink
2022-12-24 Fred Gleason <[email protected]>
Browse files Browse the repository at this point in the history
	* 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 <[email protected]>
  • Loading branch information
ElvishArtisan committed Dec 24, 2022
1 parent eb3cf2f commit b59e3b8
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 4 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -23863,3 +23863,8 @@
* Incremented the version of the 'rivwebpyapi' PyPI package to
4.0.0b4.
* Incremented the package version to 4.0.0rc0int12.
2022-12-24 Fred Gleason <[email protected]>
* Added a 'ServiceStartDelay=' directive to the '[Tuning]' section
of rd.conf(5).
* Added 'sound.target' to the 'After=' directive in
'systemd/rivendell.service.in'.
5 changes: 5 additions & 0 deletions conf/rd.conf-sample
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ TranscodingDelay=0
; then '/tmp' will be used.
;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]
; Completely disable maintenance checks on this host.
; DisableMaintChecks=Yes
Expand Down
26 changes: 25 additions & 1 deletion docs/manpages/rd.conf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<refmeta>
<refentrytitle>rd.conf</refentrytitle>
<manvolnum>5</manvolnum>
<refmiscinfo class='source'>October 2019</refmiscinfo>
<refmiscinfo class='source'>December 2022</refmiscinfo>
<refmiscinfo class='manual'>Linux Audio Manual</refmiscinfo>
</refmeta>
<refnamediv>
Expand Down Expand Up @@ -715,6 +715,21 @@
aspects of Rivendell.
</para>
<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>
<term>
<userinput>ServiceTimeout = <replaceable>secs</replaceable></userinput>
Expand Down Expand Up @@ -867,6 +882,15 @@
</variablelist>
</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>
<para>
<citerefentry>
Expand Down
5 changes: 5 additions & 0 deletions lib/rd.h
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,11 @@
*/
#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
*/
Expand Down
10 changes: 10 additions & 0 deletions lib/rdconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,13 @@ QString RDConfig::tempDirectory()
return conf_temp_directory;
}


int RDConfig::serviceStartupDelay() const
{
return conf_service_startup_delay;
}


QString RDConfig::sasStation() const
{
return conf_sas_station;
Expand Down Expand Up @@ -706,6 +713,8 @@ bool RDConfig::load()
conf_service_timeout=
profile->intValue("Tuning","ServiceTimeout",RD_DEFAULT_SERVICE_TIMEOUT);
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_matrix=profile->intValue("SASFilter","Matrix",0);
conf_sas_base_cart=profile->intValue("SASFilter","BaseCart",0);
Expand Down Expand Up @@ -820,6 +829,7 @@ void RDConfig::clear()
conf_transcoding_delay=0;
conf_service_timeout=RD_DEFAULT_SERVICE_TIMEOUT;
conf_temp_directory="";
conf_service_startup_delay=RD_DEFAULT_SERVICE_STARTUP_DELAY;
conf_sas_station="";
conf_sas_matrix=-1;
conf_sas_base_cart=1;
Expand Down
6 changes: 4 additions & 2 deletions lib/rdconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

#include <vector>

#include <qhostaddress.h>
#include <qstring.h>
#include <QHostAddress>
#include <QString>

#include <rd.h>

Expand Down Expand Up @@ -123,6 +123,7 @@ class RDConfig
int transcodingDelay() const;
int serviceTimeout() const;
QString tempDirectory();
int serviceStartupDelay() const;
QString sasStation() const;
int sasMatrix() const;
unsigned sasBaseCart() const;
Expand Down Expand Up @@ -208,6 +209,7 @@ class RDConfig
int conf_realtime_priority;
int conf_service_timeout;
QString conf_temp_directory;
int conf_service_startup_delay;
QString conf_sas_station;
int conf_sas_matrix;
unsigned conf_sas_base_cart;
Expand Down
9 changes: 9 additions & 0 deletions rdservice/rdservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down
2 changes: 1 addition & 1 deletion systemd/rivendell.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[Unit]
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]
LimitNOFILE=4096
Expand Down

0 comments on commit b59e3b8

Please sign in to comment.