2019-06-21 Fred Gleason <fredg@paravelsystems.com>

* Added 'RDApplication::syslog()' methods.
This commit is contained in:
Fred Gleason
2019-06-24 16:40:18 -04:00
parent 52dc14a3b3
commit f50447eb8b
71 changed files with 1064 additions and 887 deletions

View File

@@ -2,7 +2,7 @@
//
// Rivendell Maintenance Routines
//
// (C) Copyright 2008-2018 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2008-2019 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@@ -88,7 +88,7 @@ void MainObject::RunSystemMaintRoutine()
RunEphemeralProcess(RDSERVICE_PURGECASTS_ID,
QString(RD_PREFIX)+"/bin/rdpurgecasts",args);
syslog(LOG_INFO,"ran system-wide maintenance routines");
rda->syslog(LOG_INFO,"ran system-wide maintenance routines");
}
@@ -97,7 +97,7 @@ void MainObject::RunLocalMaintRoutine()
RunEphemeralProcess(RDSERVICE_LOCALMAINT_ID,
QString(RD_PREFIX)+"/bin/rdmaint",QStringList());
syslog(LOG_INFO,"ran local maintenance routines");
rda->syslog(LOG_INFO,"ran local maintenance routines");
}
@@ -119,7 +119,7 @@ void MainObject::RunEphemeralProcess(int id,const QString &program,
if(!svc_processes[id]->process()->waitForStarted()) {
QString err_msg=tr("unable to start")+"\""+program+"\": "+
svc_processes[id]->errorText();
syslog(LOG_WARNING,"%s",(const char *)err_msg.toUtf8());
rda->syslog(LOG_WARNING,"%s",(const char *)err_msg.toUtf8());
delete svc_processes[id];
svc_processes.remove(id);
}

View File

@@ -2,7 +2,7 @@
//
// Rivendell Services Manager
//
// (C) Copyright 2018 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2018-2019 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@@ -64,7 +64,7 @@ MainObject::MainObject(QObject *parent)
// Check for prior instance
//
if(RDGetPids("rdservice").size()>1) {
syslog(LOG_ERR,"prior instance found");
rda->syslog(LOG_ERR,"prior instance found");
exit(1);
}
@@ -73,8 +73,8 @@ MainObject::MainObject(QObject *parent)
//
rda=new RDApplication("rdservice","rdservice","\n\n",this);
if(!rda->open(&err_msg,&err_type,false)) {
syslog(LOG_ERR,"unable to open database [%s]",
(const char *)err_msg.utf8());
rda->syslog(LOG_ERR,"unable to open database [%s]",
(const char *)err_msg.utf8());
exit(2);
}
@@ -107,8 +107,8 @@ MainObject::MainObject(QObject *parent)
if(!Startup(&err_msg)) {
Shutdown();
syslog(LOG_ERR,"unable to start service component [%s]",
(const char *)err_msg.toUtf8());
rda->syslog(LOG_ERR,"unable to start service component [%s]",
(const char *)err_msg.toUtf8());
exit(3);
}
@@ -124,12 +124,12 @@ MainObject::MainObject(QObject *parent)
svc_maint_timer->start(interval);
}
else {
syslog(LOG_INFO,"maintenance checks disabled on this host");
rda->syslog(LOG_INFO,"maintenance checks disabled on this host");
}
if(!RDWritePid(RD_PID_DIR,"rdservice.pid",getuid())) {
syslog(LOG_WARNING,"unable to write pid file to \"%s/rdservice.pid\"",
RD_PID_DIR);
rda->syslog(LOG_WARNING,"unable to write pid file to \"%s/rdservice.pid\"",
RD_PID_DIR);
}
}
@@ -148,7 +148,7 @@ void MainObject::exitData()
if(global_exiting) {
Shutdown();
RDDeletePid(RD_PID_DIR,"rdservice.pid");
syslog(LOG_DEBUG,"shutting down normally");
rda->syslog(LOG_DEBUG,"shutting down normally");
exit(0);
}

View File

@@ -318,8 +318,8 @@ void MainObject::KillProgram(const QString &program)
while(pids.size()>0) {
for(int i=0;i<pids.size();i++) {
kill(pids.at(i),SIGKILL);
syslog(LOG_WARNING,"killing unresponsive program \"%s\" [PID: %d]",
(const char *)program.toUtf8(),pids.at(i));
rda->syslog(LOG_WARNING,"killing unresponsive program \"%s\" [PID: %d]",
(const char *)program.toUtf8(),pids.at(i));
}
sleep(1);
pids=RDGetPids(program);