Adds q2 repos to migrate
This commit is contained in:
1 parent
ad1f62c4ee
commit
17f1c61c9e
991 files changed
+178451
No files matched your search
@@ -0,0 +1,124 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "PrtCnvApplication.hpp"
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
#include <nglapplication/nglcoreapplication.h>
|
||||
#include <LtsCommandLineParser/LtsCommandLineParser.h>
|
||||
#include <QNetworkProxy>
|
||||
#ifndef WIN32
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
static void daemonize()
|
||||
{
|
||||
#ifndef WIN32
|
||||
pid_t pid, sid;
|
||||
|
||||
|
||||
if ( getppid() == 1 )
|
||||
return;
|
||||
|
||||
|
||||
pid = fork();
|
||||
if (pid < 0) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (pid > 0) {
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
umask(0);
|
||||
|
||||
|
||||
sid = setsid();
|
||||
if (sid < 0) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ((chdir("/")) < 0) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
freopen( "/dev/null", "r", stdin);
|
||||
freopen( "/dev/null", "w", stdout);
|
||||
freopen( "/dev/null", "w", stderr);
|
||||
#endif
|
||||
}
|
||||
|
||||
class CmdLineParser : public LtsCommandLineParser::LtsCommandLineParser
|
||||
{
|
||||
public:
|
||||
CmdLineParser()
|
||||
: LtsCommandLineParser(ProvideCommandLineParameterOptions(ExerciseId|CustomConfigFile))
|
||||
{
|
||||
addOption( { QStringList() << QStringLiteral("d") << QStringLiteral("daemonize"),
|
||||
QStringLiteral("Start in background") } );
|
||||
addOption( { QStringList() << QStringLiteral("c") << QStringLiteral("cleandb"),
|
||||
QStringLiteral("Start over with clean database") } );
|
||||
}
|
||||
|
||||
bool daemonize() const
|
||||
{
|
||||
return isSet(QStringLiteral("d"));
|
||||
}
|
||||
bool cleanDb() const
|
||||
{
|
||||
return isSet(QStringLiteral("c"));
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
QNetworkProxy::setApplicationProxy(QNetworkProxy());
|
||||
NGLCoreApplication app(argc, argv);
|
||||
|
||||
CmdLineParser options;
|
||||
if (!options.init())
|
||||
return -1;
|
||||
app.createLogger("PrtCnv", options.exerciseId());
|
||||
|
||||
if (options.daemonize())
|
||||
daemonize();
|
||||
|
||||
PrtCnv::PrtCnvApplication prtCnvApp;
|
||||
prtCnvApp.setCleanDb(options.cleanDb());
|
||||
prtCnvApp.setExerciseId(options.exerciseId());
|
||||
if (options.iniFileSet())
|
||||
prtCnvApp.setConfigFile(options.iniFile());
|
||||
|
||||
STARTUP_LOG(app.baseLogger());
|
||||
|
||||
prtCnvApp.startApp();
|
||||
int ret = app.exec();
|
||||
prtCnvApp.shutdownApp();
|
||||
|
||||
SHUTDOWN_LOG(app.baseLogger());
|
||||
|
||||
return ret;
|
||||
}
|
||||
Reference in new issue
Block a user