2019-05-17 Fred Gleason <fredg@paravelsystems.com>

* Added '--end-startup-after-caed', '--end-startup-after-ripcd',
	'--end-startup-after-rdcatchd', '--end-startup-after-rdpadd',
	'--end-startup-after-rdpadengined', '--end-startup-after-rdvairplayd',
	and '--end-startup-after-rdrepld' command line switches to
	rdservice(8).
This commit is contained in:
Fred Gleason 2019-05-17 13:58:34 -04:00
parent 03b02fdbf8
commit e2fc500ec8
5 changed files with 139 additions and 2 deletions

View File

@ -18672,3 +18672,9 @@
the lowest numbered matching cart/cut found. the lowest numbered matching cart/cut found.
2019-05-14 Fred Gleason <fredg@paravelsystems.com> 2019-05-14 Fred Gleason <fredg@paravelsystems.com>
* Added a 'Webget' chapter to the Operations Guide. * Added a 'Webget' chapter to the Operations Guide.
2019-05-17 Fred Gleason <fredg@paravelsystems.com>
* Added '--end-startup-after-caed', '--end-startup-after-ripcd',
'--end-startup-after-rdcatchd', '--end-startup-after-rdpadd',
'--end-startup-after-rdpadengined', '--end-startup-after-rdvairplayd',
and '--end-startup-after-rdrepld' command line switches to
rdservice(8).

View File

@ -6,7 +6,7 @@
<refmeta> <refmeta>
<refentrytitle>rdservice</refentrytitle> <refentrytitle>rdservice</refentrytitle>
<manvolnum>8</manvolnum> <manvolnum>8</manvolnum>
<refmiscinfo class='source'>October 2018</refmiscinfo> <refmiscinfo class='source'>Mat 2019</refmiscinfo>
<refmiscinfo class='manual'>Linux Audio Manual</refmiscinfo> <refmiscinfo class='manual'>Linux Audio Manual</refmiscinfo>
</refmeta> </refmeta>
<refnamediv> <refnamediv>
@ -30,6 +30,7 @@
<refsynopsisdiv id='synopsis'> <refsynopsisdiv id='synopsis'>
<cmdsynopsis> <cmdsynopsis>
<command>rdservice</command> <command>rdservice</command>
<arg choice='opt'><replaceable>OPTIONS</replaceable></arg>
<sbr/> <sbr/>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
@ -41,12 +42,15 @@
System, including <command>caed</command><manvolnum>8</manvolnum>, System, including <command>caed</command><manvolnum>8</manvolnum>,
<command>rdcatchd</command><manvolnum>8</manvolnum>, <command>rdcatchd</command><manvolnum>8</manvolnum>,
<command>ripcd</command><manvolnum>8</manvolnum>, <command>ripcd</command><manvolnum>8</manvolnum>,
<command>rdpadd</command><manvolnum>8</manvolnum>,
<command>rdpadengined</command><manvolnum>8</manvolnum>,
<command>rdvairplayd</command><manvolnum>8</manvolnum>, <command>rdvairplayd</command><manvolnum>8</manvolnum>,
<command>rdimport</command><manvolnum>1</manvolnum> (in dropbox mode) <command>rdimport</command><manvolnum>1</manvolnum> (in dropbox mode)
as well as periodic system maintenance tasks using as well as periodic system maintenance tasks using
<command>rdmaint</command><manvolnum>8</manvolnum>. <command>rdmaint</command><manvolnum>8</manvolnum>.
It is normally invoked by the host's boot system It is normally invoked by the host's boot system
(such as Systemd) at system boot-time and runs continuously thereafter. (such as <command>systemd</command><manvolnum>1</manvolnum>)
at system boot-time and runs continuously thereafter.
There should only be one instance of There should only be one instance of
<command>rdservice</command><manvolnum>8</manvolnum> running at any <command>rdservice</command><manvolnum>8</manvolnum> running at any
given time; attempts to start an additional instance will terminate given time; attempts to start an additional instance will terminate
@ -54,6 +58,40 @@
</para> </para>
</refsect1> </refsect1>
<refsect1 id='options'><title>Options</title>
<variablelist remap='TP'>
<varlistentry>
<term>
<option>--end-startup-after-caed</option>
</term>
<term>
<option>--end-startup-after-ripcd</option>
</term>
<term>
<option>--end-startup-after-rdcatchd</option>
</term>
<term>
<option>--end-startup-after-rdpadd</option>
</term>
<term>
<option>--end-startup-after-rdpadengined</option>
</term>
<term>
<option>--end-startup-after-rdvairplayd</option>
</term>
<term>
<option>--end-startup-after-rdrepld</option>
</term>
<listitem>
<para>
Skip the remainder of the startup sequence after the specified
component is started. (Useless except for debugging).
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id='exit_values'><title>Exit Values</title> <refsect1 id='exit_values'><title>Exit Values</title>
<para> <para>
<segmentedlist> <segmentedlist>
@ -66,6 +104,7 @@
<seglistitem><seg>1</seg><seg>Prior instance found</seg></seglistitem> <seglistitem><seg>1</seg><seg>Prior instance found</seg></seglistitem>
<seglistitem><seg>2</seg><seg>Unable to open database</seg></seglistitem> <seglistitem><seg>2</seg><seg>Unable to open database</seg></seglistitem>
<seglistitem><seg>3</seg><seg>Unable to start a service component</seg></seglistitem> <seglistitem><seg>3</seg><seg>Unable to start a service component</seg></seglistitem>
<seglistitem><seg>4</seg><seg>Unrecognized command line option</seg></seglistitem>
</segmentedlist> </segmentedlist>
</para> </para>
</refsect1> </refsect1>
@ -79,6 +118,14 @@
<citerefentry> <citerefentry>
<refentrytitle>rdimport</refentrytitle><manvolnum>1</manvolnum> <refentrytitle>rdimport</refentrytitle><manvolnum>1</manvolnum>
</citerefentry> </citerefentry>
<literal>, </literal>
<citerefentry>
<refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum>
</citerefentry>
<literal>, </literal>
<citerefentry>
<refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum>
</citerefentry>
</para> </para>
</refsect1> </refsect1>

View File

@ -57,6 +57,8 @@ MainObject::MainObject(QObject *parent)
QString err_msg; QString err_msg;
RDApplication::ErrorType err_type=RDApplication::ErrorOk; RDApplication::ErrorType err_type=RDApplication::ErrorOk;
svc_startup_target=MainObject::TargetAll;
// //
// Open the syslog // Open the syslog
// //
@ -80,6 +82,23 @@ MainObject::MainObject(QObject *parent)
exit(2); exit(2);
} }
//
// Process Startup Options
//
for(unsigned i=0;i<rda->cmdSwitch()->keys();i++) {
for(int j=0;j<MainObject::TargetAll;j++) {
MainObject::StartupTarget target=(MainObject::StartupTarget)j;
if(rda->cmdSwitch()->key(i)==TargetCommandString(target)) {
svc_startup_target=target;
rda->cmdSwitch()->setProcessed(i,true);
}
}
if(!rda->cmdSwitch()->processed(i)) {
fprintf(stderr,"rdservice: unknown command-line option\n");
exit(4);
}
}
// //
// Exit Timer // Exit Timer
// //

View File

@ -44,6 +44,9 @@ class MainObject : public QObject
{ {
Q_OBJECT; Q_OBJECT;
public: public:
enum StartupTarget {TargetCaed=0,TargetRipcd=1,TargetRdcatchd=2,
TargetRdpadd=3,TargetRdpadengined=4,
TargetRdvairplayd=5,TargetRdrepld=6,TargetAll=7};
MainObject(QObject *parent=0); MainObject(QObject *parent=0);
private slots: private slots:
@ -62,9 +65,11 @@ class MainObject : public QObject
int GetMaintInterval() const; int GetMaintInterval() const;
void RunEphemeralProcess(int id,const QString &program, void RunEphemeralProcess(int id,const QString &program,
const QStringList &args); const QStringList &args);
QString TargetCommandString(StartupTarget target) const;
QMap<int,RDProcess *> svc_processes; QMap<int,RDProcess *> svc_processes;
QTimer *svc_maint_timer; QTimer *svc_maint_timer;
QTimer *svc_exit_timer; QTimer *svc_exit_timer;
StartupTarget svc_startup_target;
}; };

View File

@ -58,6 +58,10 @@ bool MainObject::Startup(QString *err_msg)
svc_processes[RDSERVICE_CAED_ID]->errorText(); svc_processes[RDSERVICE_CAED_ID]->errorText();
return false; return false;
} }
if(svc_startup_target==MainObject::TargetCaed) {
fprintf(stderr,"Startup target caed(8) reached\n");
return true;
}
// //
// ripcd(8) // ripcd(8)
@ -71,6 +75,10 @@ bool MainObject::Startup(QString *err_msg)
svc_processes[RDSERVICE_RIPCD_ID]->errorText(); svc_processes[RDSERVICE_RIPCD_ID]->errorText();
return false; return false;
} }
if(svc_startup_target==MainObject::TargetRipcd) {
fprintf(stderr,"Startup target ripcd(8) reached\n");
return true;
}
// //
// rdcatchd(8) // rdcatchd(8)
@ -84,6 +92,10 @@ bool MainObject::Startup(QString *err_msg)
svc_processes[RDSERVICE_RDCATCHD_ID]->errorText(); svc_processes[RDSERVICE_RDCATCHD_ID]->errorText();
return false; return false;
} }
if(svc_startup_target==MainObject::TargetRdcatchd) {
fprintf(stderr,"Startup target rdcatchd(8) reached\n");
return true;
}
// //
// rdpadd(8) // rdpadd(8)
@ -97,6 +109,10 @@ bool MainObject::Startup(QString *err_msg)
svc_processes[RDSERVICE_RDPADD_ID]->errorText(); svc_processes[RDSERVICE_RDPADD_ID]->errorText();
return false; return false;
} }
if(svc_startup_target==MainObject::TargetRdpadd) {
fprintf(stderr,"Startup target rdpadd(8) reached\n");
return true;
}
// //
// *** BAND-AID * BAND_AID * YEECH! *** // *** BAND-AID * BAND_AID * YEECH! ***
@ -118,6 +134,10 @@ bool MainObject::Startup(QString *err_msg)
svc_processes[RDSERVICE_RDPADENGINED_ID]->errorText(); svc_processes[RDSERVICE_RDPADENGINED_ID]->errorText();
return false; return false;
} }
if(svc_startup_target==MainObject::TargetRdpadengined) {
fprintf(stderr,"Startup target rdpadengined(8) reached\n");
return true;
}
// //
// rdvairplayd(8) // rdvairplayd(8)
@ -131,6 +151,10 @@ bool MainObject::Startup(QString *err_msg)
svc_processes[RDSERVICE_RDVAIRPLAYD_ID]->errorText(); svc_processes[RDSERVICE_RDVAIRPLAYD_ID]->errorText();
return false; return false;
} }
if(svc_startup_target==MainObject::TargetRdvairplayd) {
fprintf(stderr,"Startup target rdvairplayd(8) reached\n");
return true;
}
// //
// rdrepld(8) // rdrepld(8)
@ -150,6 +174,10 @@ bool MainObject::Startup(QString *err_msg)
} }
} }
delete q; delete q;
if(svc_startup_target==MainObject::TargetRdrepld) {
fprintf(stderr,"Startup target rdrepld(8) reached\n");
return true;
}
if(!StartDropboxes(err_msg)) { if(!StartDropboxes(err_msg)) {
return false; return false;
@ -296,3 +324,35 @@ void MainObject::KillProgram(const QString &program)
pids=RDGetPids(program); pids=RDGetPids(program);
} }
} }
QString MainObject::TargetCommandString(MainObject::StartupTarget target) const
{
switch(target) {
case MainObject::TargetCaed:
return QString("--end-startup-after-caed");
case MainObject::TargetRipcd:
return QString("--end-startup-after-ripcd");
case MainObject::TargetRdcatchd:
return QString("--end-startup-after-rdcatchd");
case MainObject::TargetRdpadd:
return QString("--end-startup-after-rdpadd");
case MainObject::TargetRdpadengined:
return QString("--end-startup-after-rdpadengined");
case MainObject::TargetRdvairplayd:
return QString("--end-startup-after-rdvairplayd");
case MainObject::TargetRdrepld:
return QString("--end-startup-after-rdrepld");
case MainObject::TargetAll:
break;
}
return QString();
}