Erv Walter edited this page Sep 24, 2013 · 4 revisions


You need Node.js installed to use this. Then, you'll need to install the required node modules by running npm install in the folder where you put the sharemonitor code.

Sample Configuration

    "mode": "stdin", // stdin, pipe, or tail
    "filename": "shares.log", // only needed for pipe or tail modes
    "key": "secret",
    "servers": [

General Config

There are two general settings you need to configure. Edit default.json in the config/ folder to make these choices.

  • key, submissions to your web servers will have this key appended to the query string. Set this if your web site requires an apikey to prevent abusive share submissions
  • servers, this is an array of servers to send each share to. Note, the actual submissions will go to a /submitshare path under each server listed here, so just specify the top level hostname/port

File Watching or "Tail" Mode

The simplest setup is to configure cgminer to log all shares to a file using the -sharelog option. You then configure this script to tail that file and submit any new shares to the configured servers. In addition to the settings above, you need to have these options set:

  • mode, should be set to tail
  • filename, should be the path to the file that cgminer is logging shares to

Note, with this setup, you're going to quickly end up with a very large file containing found shares. If you have the disk space available, that's probably not tragic. Unfortunately, cgminer doesn't support log rotation, so you have to restart cgminer anytime you want to clear out your log file and start a new one. This can, of course, be easily scripted, but the other modes are intended to avoid this hassle.

Named Pipe or FIFO Mode

This is similar to the previous mode except instead of telling cgminer to write to a normal file, you first create a named pipe (aka a 'fifo') using the mkfifo Linux command. This creates a special kind of file that lets cgminer write shares and the script monitor read shares without live and without any disk space being used. Note, the share monitor should be started before cgminer in this case and should be kept running with something like forever or else cgminer will not start mining.

The setup requires these settings in addition to the general server and key settings:

  • mode, should be set to pipe
  • filename, should be the path to the named pipe that you created with mkfifo and that cgminer is logging shares to

Stdin Mode

This is probably the most convenient mode. It takes advantage of two features of cgminer: -sharelog and -monitor. The trick is to start cgminer with -sharelog 2. This causes cgminer to log shares to stderr, which is not actually visible on the screen when using the ncurses user interface. Then you also include -monitor /path/to/ to send all cgminer output (including the non-visible share log that is going to stderr) to the share monitor script. cgminer will automatically start the share monitor when it starts up and will close it when it quits.

The setup only requires the mode settings in addition to the general server and key settings:

  • mode, should be set to stdin
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.