Fixed backgrounding for XMRigCCServer on Windows
Cleanup of default config files Extendend Readme.md
This commit is contained in:
parent
eda12de623
commit
42522a64ea
9 changed files with 96 additions and 115 deletions
|
@ -34,6 +34,13 @@
|
|||
#include "Options.h"
|
||||
#include "Summary.h"
|
||||
|
||||
#if _WIN32
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#else
|
||||
# include "unistd.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYSLOG_H
|
||||
# include "log/SysLog.h"
|
||||
#endif
|
||||
|
@ -90,6 +97,10 @@ int CCServer::start()
|
|||
uv_signal_start(&m_signal, CCServer::onSignal, SIGTERM);
|
||||
uv_signal_start(&m_signal, CCServer::onSignal, SIGINT);
|
||||
|
||||
if (m_options->background()) {
|
||||
moveToBackground();
|
||||
}
|
||||
|
||||
Summary::print();
|
||||
|
||||
Service::start();
|
||||
|
@ -150,4 +161,38 @@ void CCServer::onSignal(uv_signal_t* handle, int signum)
|
|||
|
||||
uv_signal_stop(handle);
|
||||
m_self->stop();
|
||||
}
|
||||
}
|
||||
|
||||
void CCServer::moveToBackground()
|
||||
{
|
||||
#ifdef WIN32
|
||||
HWND hcon = GetConsoleWindow();
|
||||
if (hcon) {
|
||||
ShowWindow(hcon, SW_HIDE);
|
||||
} else {
|
||||
HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
CloseHandle(h);
|
||||
FreeConsole();
|
||||
}
|
||||
#else
|
||||
int i = fork();
|
||||
if (i < 0) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (i > 0) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
i = setsid();
|
||||
|
||||
if (i < 0) {
|
||||
LOG_ERR("setsid() failed (errno = %d)", errno);
|
||||
}
|
||||
|
||||
i = chdir("/");
|
||||
if (i < 0) {
|
||||
LOG_ERR("chdir() failed (errno = %d)", errno);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ protected:
|
|||
|
||||
private:
|
||||
void stop();
|
||||
void moveToBackground();
|
||||
|
||||
static void onSignal(uv_signal_t* handle, int signum);
|
||||
|
||||
|
@ -58,7 +59,6 @@ private:
|
|||
Httpd* m_httpd;
|
||||
Options* m_options;
|
||||
uv_signal_t m_signal;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
"threads": null, // number of miner threads
|
||||
"pools": [
|
||||
{
|
||||
"url": "pool.minemonero.pro:5555", // URL of mining server
|
||||
"url": "", // URL of mining server
|
||||
"user": "", // username for mining server
|
||||
"pass": "x", // password for mining server
|
||||
"keepalive": true, // send keepalived for prevent timeout (need pool support)
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
"algo": "cryptonight", // cryptonight (default) or cryptonight-lite
|
||||
"av": 0, // algorithm variation, 0 auto select
|
||||
"background": false, // true to run the miner in the background
|
||||
"colors": true, // false to disable colored output
|
||||
"colors": true, // false to disable colored output
|
||||
"cpu-affinity": null, // set process affinity to CPU core(s), mask "0x3" for cores 0 and 1
|
||||
"cpu-priority": null, // set process priority (0 idle, 2 normal to 5 highest)
|
||||
"donate-level": 5, // donate level, mininum 1%
|
||||
"log-file": null, // log all output to a file, example: "c:/some/path/xmrig.log"
|
||||
"max-cpu-usage": 75, // maximum CPU usage for automatic mode, usually limiting factor is CPU cache not this option.
|
||||
"max-cpu-usage": 75, // maximum CPU usage for automatic mode, usually limiting factor is CPU cache not this option.
|
||||
"print-time": 60, // print hashrate report every N seconds
|
||||
"retries": 5, // number of times to retry before switch to backup server
|
||||
"retry-pause": 5, // time to pause between retries
|
||||
|
@ -16,7 +16,7 @@
|
|||
"threads": null, // number of miner threads
|
||||
"pools": [
|
||||
{
|
||||
"url": "pool.minemonero.pro:5555", // URL of mining server
|
||||
"url": "", // URL of mining server
|
||||
"user": "", // username for mining server
|
||||
"pass": "x", // password for mining server
|
||||
"keepalive": true, // send keepalived for prevent timeout (need pool support)
|
||||
|
@ -33,4 +33,4 @@
|
|||
"access-token": null, // access token for CC Server (has to be the same in config_cc.json)
|
||||
"worker-id": null // custom worker-id for CC Server (otherwise hostname is used)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,6 +5,7 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2016-2017 XMRig <support@xmrig.com>
|
||||
* Copyright 2017- BenDr0id <ben@graef.in>
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
@ -34,8 +35,14 @@
|
|||
* Switching is instant, and only happens after a successful connection, so you never loose any hashes.
|
||||
*
|
||||
* If you plan on changing this setting to 0 please consider making a one off donation to my wallet:
|
||||
* XMR: 46FkYo7x6LqYjLQo4Jd84UTGBybW7tsWqJaQVLPhbUSK19ajSTMY9T2Sa2LH6CfWhSingjvQARtfeM4Feekpp2yFR1wsFNT
|
||||
* BTC: 128qLZCaGdoWhBTfaS7rytpbvG4mNTyAQm
|
||||
* AEON: Wmtm4S2cQ8uEBBAVjvbiaVAPv2d6gA1mAUmBmjna4VF7VixLxLRUYag5cvsym3WnuzdJ9zvhQ3Xwa8gWxPDPRfcQ3AUkYra3W
|
||||
*
|
||||
* XMRig's wallet:
|
||||
* XMR: 48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD
|
||||
* BTC: 1P7ujsXeX7GxQwHNnJsRMgAdNkFZmNVqJT
|
||||
*
|
||||
*/
|
||||
constexpr const int kDonateLevel = 5;
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2016-2017 XMRig <support@xmrig.com>
|
||||
* Copyright 2017- BenDr0id <ben@graef.in>
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
@ -28,16 +29,17 @@
|
|||
#define APP_ID "xmrigCC"
|
||||
#define APP_NAME "XMRigCC"
|
||||
#define APP_DESC "XMRigCC Command'n'Control Server"
|
||||
#define APP_VERSION "1.0.0"
|
||||
#define APP_VERSION "1.0.4"
|
||||
#define APP_COPYRIGHT "Copyright (C) 2017- BenDr0id"
|
||||
# else
|
||||
#define APP_ID "xmrigCC"
|
||||
#define APP_NAME "XMRigCC"
|
||||
#define APP_DESC "XMRigCC CPU miner"
|
||||
#define APP_VERSION "2.4.1"
|
||||
#define APP_VERSION "2.4.2"
|
||||
#define APP_COPYRIGHT "Copyright (C) 2017- BenDr0id"
|
||||
#endif
|
||||
#define APP_DOMAIN "xmrig.com"
|
||||
#define APP_SITE "www.xmrig.com"
|
||||
#define APP_COPYRIGHT "Copyright (C) 2016-2017 xmrig.com"
|
||||
#define APP_DOMAIN ""
|
||||
#define APP_SITE "https://github.com/Bendr0id/xmrigCC"
|
||||
#define APP_KIND "cpu"
|
||||
|
||||
#define APP_VER_MAJOR 2
|
||||
|
|
|
@ -27,6 +27,5 @@
|
|||
|
||||
int main(int argc, char** argv) {
|
||||
CCServer ccServer(argc, argv);
|
||||
|
||||
return ccServer.start();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue