DaemonManager: remove systemd check

This commit is contained in:
plowsof 2023-02-21 00:19:30 +00:00
parent bdd91b053d
commit 8a910ad4c7
3 changed files with 1 additions and 36 deletions

View file

@ -299,13 +299,7 @@ Rectangle {
startP2Pool() startP2Pool()
} }
else { else {
var underSystemd = daemonManager.checkUnderSystemd(); daemonManager.stopAsync(persistentSettings.nettype, persistentSettings.blockchainDataDir, startP2PoolLocal)
if (underSystemd) {
miningError(qsTr("Monerod is managed by Systemd. Manually add --zmq-pub tcp://127.0.0.1:18083 to the unit file <br>") + translationManager.emptyString)
}
else {
daemonManager.stopAsync(persistentSettings.nettype, persistentSettings.blockchainDataDir, startP2PoolLocal)
}
} }
} }
else { else {

View file

@ -342,34 +342,6 @@ bool DaemonManager::checkLmdbExists(QString datadir) {
return validateDataDir(datadir).value("lmdbExists").value<bool>(); return validateDataDir(datadir).value("lmdbExists").value<bool>();
} }
bool DaemonManager::checkUnderSystemd() {
#ifdef Q_OS_LINUX
QProcess p;
QStringList args;
args << "monerod";
p.setProgram("pgrep");
p.setArguments(args);
p.start();
p.waitForFinished();
QString pid = p.readAllStandardOutput().trimmed();
if (pid.isEmpty()) {
return false;
}
args.clear();
args << "-c";
args << "ps -eo pid,cgroup | grep " + pid + " | grep -q .service$";
p.setProgram("sh");
p.setArguments(args);
p.start();
p.waitForFinished();
if (p.exitCode() == 0) {
return true;
}
#endif
return false;
}
QString DaemonManager::getArgs(const QString &dataDir) { QString DaemonManager::getArgs(const QString &dataDir) {
if (!running(NetworkType::MAINNET, dataDir)) { if (!running(NetworkType::MAINNET, dataDir)) {
return args; return args;

View file

@ -59,7 +59,6 @@ public:
Q_INVOKABLE QVariantMap validateDataDir(const QString &dataDir) const; Q_INVOKABLE QVariantMap validateDataDir(const QString &dataDir) const;
Q_INVOKABLE bool checkLmdbExists(QString datadir); Q_INVOKABLE bool checkLmdbExists(QString datadir);
Q_INVOKABLE QString getArgs(const QString &dataDir); Q_INVOKABLE QString getArgs(const QString &dataDir);
Q_INVOKABLE bool checkUnderSystemd();
private: private: