Fixed backgrounding for XMRigCCServer on Windows

Cleanup of default config files
Extendend Readme.md
This commit is contained in:
BenDroid 2017-10-25 22:48:59 +02:00
parent 8e29430c75
commit e91db9e056
9 changed files with 96 additions and 115 deletions

View file

@ -16,39 +16,30 @@ The modified version can also handle commands like "update config", "start/stop
XMRig is high performance Monero (XMR) / Aeon CPU miner, with the official full Windows support. XMRig is high performance Monero (XMR) / Aeon CPU miner, with the official full Windows support.
Originally based on cpuminer-multi with heavy optimizations/rewrites and removing a lot of legacy code, since version 1.0.0 complete rewritten from scratch on C++. Originally based on cpuminer-multi with heavy optimizations/rewrites and removing a lot of legacy code, since version 1.0.0 complete rewritten from scratch on C++.
* This is the CPU-mining version, there is also a [NVIDIA GPU version](https://github.com/xmrig/xmrig-nvidia).
* [Roadmap](https://github.com/xmrig/xmrig/issues/106) for next releases.
<img src="http://i.imgur.com/OKZRVDh.png" width="619" >
#### Table of contents #### Table of contents
* [Features](#additional-features-of-xmrigcc) * [Features](#features-of-xmrigcc)
* [Download](#download) * [Download](#download)
* [Usage](#usage) * [Usage](#usage)
* [Algorithm variations](#algorithm-variations) * [Algorithm variations](#algorithm-variations)
* [Build](https://raw.githubusercontent.com/Bendr0id/xmrigCC/master/howto_and_notes.txt) * [Build on Debian/Ubuntu](https://github.com/Bendr0id/xmrigCC/wiki/Build-Debian%5CUbuntu)
* [Common Issues](#common-issues) * [Common Issues](#common-issues)
* [Other information](#other-information) * [Other information](#other-information)
* [Donations](#donations) * [Donations](#donations)
* [Contacts](#contacts) * [Contacts](#contacts)
* [Wiki](https://github.com/Bendr0id/xmrigCC/wiki/)
## Additional features of xmrigCC ## Features of xmrigCC
* Command and control server * Command and control server
* CC Dashboard with: * CC Dashboard with:
* statistics of all connected miners * statistics of all connected miners
* remote control miners (start/stop/restart/shutdown) * remote control miners (start/stop/restart/shutdown)
* remote configuration changes of miners * remote configuration changes of miners
* Daemon around the miner to restart and apply config changes * Daemon around the miner to restart and apply config changes
* AND all features of the latest xmrig
## Features of xmrig
* High performance. * High performance.
* Official Windows support. * Official Windows support.
* Small Windows executable, without dependencies. * Small Windows executable, without dependencies.
* x86/x64 support.
* Support for backup (failover) mining server. * Support for backup (failover) mining server.
* keepalived support. * keepalived support.
* Command line options compatible with cpuminer.
* CryptoNight-Lite support for AEON. * CryptoNight-Lite support for AEON.
* Smart automatic [CPU configuration](https://github.com/xmrig/xmrig/wiki/Threads). * Smart automatic [CPU configuration](https://github.com/xmrig/xmrig/wiki/Threads).
* Nicehash support * Nicehash support
@ -65,7 +56,7 @@ Originally based on cpuminer-multi with heavy optimizations/rewrites and removin
xmrigCCServer --cc-port=3344 --cc-user=admin --cc-pass=pass --cc-access-token=SECRET_TOKEN_TO_ACCESS_CC_SERVER xmrigCCServer --cc-port=3344 --cc-user=admin --cc-pass=pass --cc-access-token=SECRET_TOKEN_TO_ACCESS_CC_SERVER
``` ```
### Options xmrigDaemon ### Options xmrigCCServer
``` ```
--cc-user=USERNAME CC Server admin user --cc-user=USERNAME CC Server admin user
--cc-pass=PASSWORD CC Server admin pass --cc-pass=PASSWORD CC Server admin pass
@ -83,17 +74,14 @@ xmrigCCServer --cc-port=3344 --cc-user=admin --cc-pass=pass --cc-access-token=SE
``` ```
Also you can use configuration via config file, default **[config_cc.json](https://github.com/Bendr0id/xmrigCC/wiki/Config-XMRigCCServer)**. You can load multiple config files and combine it with command line options.
### Basic example xmrigDaemon ### Basic example xmrigDaemon
``` ```
xmrigDaemon -o pool.minemonero.pro:5555 -u YOUR_WALLET -p x -k --cc-url=IP_OF_CC_SERVER:PORT --cc-access-token=SECRET_TOKEN_TO_ACCESS_CC_SERVER --cc-worker-id=OPTIONAL_WORKER_NAME xmrigDaemon -o pool.minemonero.pro:5555 -u YOUR_WALLET -p x -k --cc-url=IP_OF_CC_SERVER:PORT --cc-access-token=SECRET_TOKEN_TO_ACCESS_CC_SERVER --cc-worker-id=OPTIONAL_WORKER_NAME
``` ```
### Failover xmrigDaemon
```
xmrigDaemon -o pool.minemonero.pro:5555 -u YOUR_WALLET1 -p x -k -o pool.supportxmr.com:5555 -u YOUR_WALLET2 -p x -k --cc-url=IP_OF_CC_SERVER:PORT --cc-access-token=SECRET_TOKEN_TO_ACCESS_CC_SERVER --cc-worker-id=OPTIONAL_WORKER_NAME
```
For failover you can add multiple pools, maximum count not limited.
### Options xmrigDaemon ### Options xmrigDaemon
``` ```
-a, --algo=ALGO cryptonight (default) or cryptonight-lite -a, --algo=ALGO cryptonight (default) or cryptonight-lite
@ -131,7 +119,7 @@ For failover you can add multiple pools, maximum count not limited.
``` ```
Also you can use configuration via config file, default **config.json**. You can load multiple config files and combine it with command line options. Also you can use configuration via config file, default **[config.json](https://github.com/Bendr0id/xmrigCC/wiki/Config-XMRigMiner)**. You can load multiple config files and combine it with command line options.
## Algorithm variations ## Algorithm variations
Since version 0.8.0. Since version 0.8.0.
@ -141,10 +129,25 @@ Since version 0.8.0.
* `--av=4` Lower power mode (double hash) of `3`. * `--av=4` Lower power mode (double hash) of `3`.
## Common Issues ## Common Issues
### HUGE PAGES unavailable ### Windows only: DLL error on starting
* Make sure that you installed latest Visual C++ Redistributable für Visual Studio 2015. Can be downloaded here: [microsoft.com](https://www.microsoft.com/de-de/download/details.aspx?id=48145)
### Linux only: Background mode
* The `--background` option will only work properly for the XMRigServer. But there is a simple workaround for the XMRigDaemon process. Just append an `&amp;` to the command and it will run smoothly in the background.
`./xmrigDaemon --config=my_config_cc.json &amp;`
### HUGE PAGES unavailable (Windows)
* Run XMRig as Administrator. * Run XMRig as Administrator.
* Since version 0.8.0 XMRig automatically enable SeLockMemoryPrivilege for current user, but reboot or sign out still required. [Manual instruction](https://msdn.microsoft.com/en-gb/library/ms190730.aspx). * Since version 0.8.0 XMRig automatically enable SeLockMemoryPrivilege for current user, but reboot or sign out still required. [Manual instruction](https://msdn.microsoft.com/en-gb/library/ms190730.aspx).
### HUGE PAGES unavailable (Linux)
* Before starting XMRigDaemon set huge pages
`sudo sudo sysctl -w vm.nr_hugepages=256`
## Other information ## Other information
* No HTTP support, only stratum protocol support. * No HTTP support, only stratum protocol support.
* No TLS support. * No TLS support.
@ -165,16 +168,16 @@ Please note performance is highly dependent on system load. The numbers above ar
## Donations ## Donations
* Default donation 5% (5 minutes in 100 minutes) can be reduced to 1% via command line option `--donate-level`. * Default donation 5% (5 minutes in 100 minutes) can be reduced to 1% via command line option `--donate-level`.
* The donations will be automatically splitted (50/50) on my pool between xmrig and me. * The donations will be automatically splitted (50/50) on my pool to xmrig's and my wallet.
##### BenDroid (xmrigCC): ##### BenDroid (xmrigCC):
XMR: `46FkYo7x6LqYjLQo4Jd84UTGBybW7tsWqJaQVLPhbUSK19ajSTMY9T2Sa2LH6CfWhSingjvQARtfeM4Feekpp2yFR1wsFNT` XMR: `46FkYo7x6LqYjLQo4Jd84UTGBybW7tsWqJaQVLPhbUSK19ajSTMY9T2Sa2LH6CfWhSingjvQARtfeM4Feekpp2yFR1wsFNT`
AEON: `Wmtm4S2cQ8uEBBAVjvbiaVAPv2d6gA1mAUmBmjna4VF7VixLxLRUYag5cvsym3WnuzdJ9zvhQ3Xwa8gWxPDPRfcQ3AUkYra3W` AEON: `Wmtm4S2cQ8uEBBAVjvbiaVAPv2d6gA1mAUmBmjna4VF7VixLxLRUYag5cvsym3WnuzdJ9zvhQ3Xwa8gWxPDPRfcQ3AUkYra3W`
BTC: `128qLZCaGdoWhBTfaS7rytpbvG4mNTyAQm` BTC: `128qLZCaGdoWhBTfaS7rytpbvG4mNTyAQm`
##### xmrig: ##### xmrig:
XMR: `48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD` XMR: `48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD`
BTC: `1P7ujsXeX7GxQwHNnJsRMgAdNkFZmNVqJT` BTC: `1P7ujsXeX7GxQwHNnJsRMgAdNkFZmNVqJT`
## Contacts xmrigCC ## Contacts xmrigCC
* ben [at] graef.in * ben [at] graef.in

View file

@ -1,78 +1,3 @@
installation:
sudo apt-get install git build-essential cmake libuv1-dev libmicrohttpd-dev libcurl4-gnutls-dev
(or any other libcurl)
git clone https://github.com/Bendr0id/xmrigCC.git
cd xmrigCC
mkdir build
cd build
cmake ..
make
config cc server:
sample is in src folder (config_cc.json):
{
"background": false, // true to run the cc-server in the background (no console)
"colors": true, // false to disable colored output
"log-file": null, // log all output to a file
"syslog": false, // use system log for output messages
"cc-server": {
"port": 3344, // port the CC Server will listens on
"access-token": null, // access token for CC Clients (should be set!!!)
"user": "admin", // admin user for access CC Dashboard
"pass": "pass", // admin pass for access CC Dashboard
"client-config-folder" : null, // folder which contains the client-config files (null=current)
"custom-dashboard" : "index.html" // dashboard html file
}
}
config cc client (miner):
sample is in src folder (config.json):
{
"algo": "cryptonight-light",
"av": 0,
"background": false,
"colors": true,
"cpu-affinity": null,
"cpu-priority": null,
"donate-level": 0,
"log-file": null,
"max-cpu-usage": 75,
"print-time": 60,
"retries": 5,
"retry-pause": 5,
"safe": false,
"syslog": false,
"threads": null,
"pools": [
{
"url": "pool.aeonmining.pro:3333", // your pool here
"user": "Wmtm4S2cQ8uEBBAVjvbiaVAPv2d6gA1mAUmBmjna4VF7VixLxLRUYag5cvsym3WnuzdJ9zvhQ3Xwa8gWxPDPRfcQ3AUkYra3W", // your wallet here
"pass": "donate",
"keepalive": true,
"nicehash": false
}
],
"api": {
"port": 3339, // port for the miner API https://github.com/xmrig/xmrig/wiki/API
"access-token": null, // access token for API
"worker-id": null // custom worker-id for API
},
"cc-client": {
"url": "localhost:3344", // url of the CC Server (ip:port)
"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)
}
}
config to deploy / notes: config to deploy / notes:

View file

@ -34,6 +34,13 @@
#include "Options.h" #include "Options.h"
#include "Summary.h" #include "Summary.h"
#if _WIN32
#include <winsock2.h>
#include <windows.h>
#else
# include "unistd.h"
#endif
#ifdef HAVE_SYSLOG_H #ifdef HAVE_SYSLOG_H
# include "log/SysLog.h" # include "log/SysLog.h"
#endif #endif
@ -90,6 +97,10 @@ int CCServer::start()
uv_signal_start(&m_signal, CCServer::onSignal, SIGTERM); uv_signal_start(&m_signal, CCServer::onSignal, SIGTERM);
uv_signal_start(&m_signal, CCServer::onSignal, SIGINT); uv_signal_start(&m_signal, CCServer::onSignal, SIGINT);
if (m_options->background()) {
moveToBackground();
}
Summary::print(); Summary::print();
Service::start(); Service::start();
@ -150,4 +161,38 @@ void CCServer::onSignal(uv_signal_t* handle, int signum)
uv_signal_stop(handle); uv_signal_stop(handle);
m_self->stop(); 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
}

View file

@ -49,6 +49,7 @@ protected:
private: private:
void stop(); void stop();
void moveToBackground();
static void onSignal(uv_signal_t* handle, int signum); static void onSignal(uv_signal_t* handle, int signum);
@ -58,7 +59,6 @@ private:
Httpd* m_httpd; Httpd* m_httpd;
Options* m_options; Options* m_options;
uv_signal_t m_signal; uv_signal_t m_signal;
}; };

View file

@ -16,7 +16,7 @@
"threads": null, // number of miner threads "threads": null, // number of miner threads
"pools": [ "pools": [
{ {
"url": "pool.minemonero.pro:5555", // URL of mining server "url": "", // URL of mining server
"user": "", // username for mining server "user": "", // username for mining server
"pass": "x", // password for mining server "pass": "x", // password for mining server
"keepalive": true, // send keepalived for prevent timeout (need pool support) "keepalive": true, // send keepalived for prevent timeout (need pool support)

View file

@ -2,12 +2,12 @@
"algo": "cryptonight", // cryptonight (default) or cryptonight-lite "algo": "cryptonight", // cryptonight (default) or cryptonight-lite
"av": 0, // algorithm variation, 0 auto select "av": 0, // algorithm variation, 0 auto select
"background": false, // true to run the miner in the background "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-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) "cpu-priority": null, // set process priority (0 idle, 2 normal to 5 highest)
"donate-level": 5, // donate level, mininum 1% "donate-level": 5, // donate level, mininum 1%
"log-file": null, // log all output to a file, example: "c:/some/path/xmrig.log" "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 "print-time": 60, // print hashrate report every N seconds
"retries": 5, // number of times to retry before switch to backup server "retries": 5, // number of times to retry before switch to backup server
"retry-pause": 5, // time to pause between retries "retry-pause": 5, // time to pause between retries
@ -16,7 +16,7 @@
"threads": null, // number of miner threads "threads": null, // number of miner threads
"pools": [ "pools": [
{ {
"url": "pool.minemonero.pro:5555", // URL of mining server "url": "", // URL of mining server
"user": "", // username for mining server "user": "", // username for mining server
"pass": "x", // password for mining server "pass": "x", // password for mining server
"keepalive": true, // send keepalived for prevent timeout (need pool support) "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) "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) "worker-id": null // custom worker-id for CC Server (otherwise hostname is used)
} }
} }

View file

@ -5,6 +5,7 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet> * Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com> * Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2016-2017 XMRig <support@xmrig.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 * 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. * 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: * 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 * XMR: 48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD
* BTC: 1P7ujsXeX7GxQwHNnJsRMgAdNkFZmNVqJT * BTC: 1P7ujsXeX7GxQwHNnJsRMgAdNkFZmNVqJT
*
*/ */
constexpr const int kDonateLevel = 5; constexpr const int kDonateLevel = 5;

View file

@ -5,6 +5,7 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet> * Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com> * Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2016-2017 XMRig <support@xmrig.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 * This program is free software: you can redistribute it and/or modify
@ -28,16 +29,17 @@
#define APP_ID "xmrigCC" #define APP_ID "xmrigCC"
#define APP_NAME "XMRigCC" #define APP_NAME "XMRigCC"
#define APP_DESC "XMRigCC Command'n'Control Server" #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 # else
#define APP_ID "xmrigCC" #define APP_ID "xmrigCC"
#define APP_NAME "XMRigCC" #define APP_NAME "XMRigCC"
#define APP_DESC "XMRigCC CPU miner" #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 #endif
#define APP_DOMAIN "xmrig.com" #define APP_DOMAIN ""
#define APP_SITE "www.xmrig.com" #define APP_SITE "https://github.com/Bendr0id/xmrigCC"
#define APP_COPYRIGHT "Copyright (C) 2016-2017 xmrig.com"
#define APP_KIND "cpu" #define APP_KIND "cpu"
#define APP_VER_MAJOR 2 #define APP_VER_MAJOR 2

View file

@ -27,6 +27,5 @@
int main(int argc, char** argv) { int main(int argc, char** argv) {
CCServer ccServer(argc, argv); CCServer ccServer(argc, argv);
return ccServer.start(); return ccServer.start();
} }