Author

Topic: [ANN] [Datacoin] DataMinerWatch – bash script for restarting Primeminer on hangs (Read 2142 times)

hero member
Activity: 687
Merit: 500
Great news, let us know when you have tested it yourself.
newbie
Activity: 46
Merit: 0
Xolokram updated his primeminer to 0.8 RC2 version, introducing (finnally!) -poolip2, -poolip3 & -exitondisc launch parameters. They are the only change in this release.

I noticed that few days ago and hoped to test it myself, but... preety much this two weeks finnaly came. Looking at beeeeer technical thread doesn't explain much.

From Xolo's post:
Quote
ps. i'm working on a bigger update to remove/clean up the code to make the miner more lightweight, update to mikaelh's new version & improve the network code, but this is taking longer than i thought so i'll release this smaller update on the old version first
I hope that build-in-fallback with improved networking will solve the issues I'm trying to solve with external script.
newbie
Activity: 46
Merit: 0
So getting "Segmenation fault" is normal when mining Datacoin?
From my experience segfaults aren't that often. I faced connection problms mainly, i.e. when primeminer is working and mining, but not sending shares to pool for some unknown to me reason (and here comes the DMW).

I just got this script running though, and so far, so good. I haven't been able to get the logs working right. I don't think I'm saving them in the right directory, but I probably don't need to see them anyway.
If you don't see any errors in the output, then the catalog with logs should exist somewhere (otherwise, invocated shell programs would be calling for nonexistent resource).
legendary
Activity: 2632
Merit: 2790
Shitcoin Minimalist
jhprimeminer is much more stable.
I just got this script running though, and so far, so good. I haven't been able to get the logs working right. I don't think I'm saving them in the right directory, but I probably don't need to see them anyway.
legendary
Activity: 1428
Merit: 1001
getmonero.org
Seriously what a joke. If you want this coin to be something you better have a miner that doesn't crash.

Having a work around that is restarting the miner when it crashes is not OK.
This should be fixed by developer of primecoin fork.

Go ahead and write a miner that doesnt crash for primecoin algo better than primeminer...
hero member
Activity: 687
Merit: 500
Seriously what a joke. If you want this coin to be something you better have a miner that doesn't crash.

Having a work around that is restarting the miner when it crashes is not OK.
This should be fixed by developer of primecoin fork.
legendary
Activity: 1428
Merit: 1001
getmonero.org
So getting "Segmenation fault" is normal when mining Datacoin?



when using primeminer. Use this and you will be okay!
hero member
Activity: 687
Merit: 500
So getting "Segmenation fault" is normal when mining Datacoin?

sr. member
Activity: 481
Merit: 252
It's a visual file manager (but using text).  It shows all the files and directories in a directory.  It has Edit file, View file etc.  I've used it for years. I think you will find it interesting in a linux VPS instance.

http://en.wikipedia.org/wiki/Midnight_Commander
legendary
Activity: 1428
Merit: 1001
getmonero.org
Greek have you tried to run Midnight Commander (mc) in putty?


No. What does it do?
sr. member
Activity: 481
Merit: 252
Greek have you tried to run Midnight Commander (mc) in putty?
newbie
Activity: 46
Merit: 0
I guess that you still had process named "primeminer" hidden somewhere in a background (yeach I know, it's better to use pid in script...). When you rebooted you simply killed it.
OK, will make bugfix for that (perfect moment, I have shitload of exams now).
legendary
Activity: 1428
Merit: 1001
getmonero.org
I changed my pool from gpool to xpool today. And while all of my vps changed only one of them for some reason wont start mining prompting this error:

grep: /home/user/datawatch/logs/: Is a directory

Edit: i rebooted and it now works. still i have tried what you said but i will.
legendary
Activity: 1428
Merit: 1001
getmonero.org
I will try this today and i will tell you!
newbie
Activity: 46
Merit: 0
I'm happy you got it working, but there one thing more you would want in your case scenario. Script will not start when vps will be for whaever reason restarted.*
You can try supervisor like below. I would be thankful if you would ping me back and tell if it's working (why? see *).

# Instal the supervisor
sudo apt-get install supervisor

# Make a conffile
sudo nano /etc/supervisor/conf.d/datacoin.conf

# Paste there this, should work... Fat manual: http://supervisord.org/configuration.html#program-x-section-settings
[program:datawatch]
command=/patch/to/datawatch.sh pool mode
stdout_logfile=NONE
stderr_logfile=/patch/to/logs/catalog/%(program_name)s.log
autorestart=true


# Restart supervisor daemon
sudo /etc/init.d/supervisor stop
sudo /etc/init.d/supervisor start


There will be one additional logfile with stderr as you see. Could be set to NONE too, but one more file containing eventual errors doesn't hurt (and might sometimes help).

*It's a bug and feature BOTH. I mine with my pc only, as I don't have credit card/paypal/etc so I can't even try the free trials outthere, and if my pc goes down for whatever reason I want to inspect it manually, and for sure I don't want to automatically stress the machine (in case of cooling faillure for example).
legendary
Activity: 1428
Merit: 1001
getmonero.org
Yep i got it working Smiley Thank you very much! Not only this is very helpful but also it made me learn nano which i have never heard of and i needed! and a few more linux things Smiley

Lets see if it helps and mining will continue until tomorrow...

Many thanks! Now i have to do it to the rest of my machines Tongue
newbie
Activity: 46
Merit: 0
Back online...

I mean i cant edit. I tried vi the file but then i cant do anything else Tongue How do i edit?
Well, actually forcing linux noob to use vi is a well known method of generating random keystrokes (its a hermetic joke ;-).
I'm advanced linux user, so I am able to close vi without that (its autoirony).
Try to use nano editor (its actual advice). Should work nowdays (pros of vi is compability with every wickest console).

1.Do i really have to change the catalog that this stores the log files?
Yes, unless patch /home/arkhebuz/datacoin exist on your system. If not, you will get only errors... You should store logs in a separate catalog for clarity.

2.What about the network interface... Huh i am confused  Huh
You should have folder in /sys/class/net catalog, named like your network interface (using linux convention, look here for a second http://rhinoceros.hubpages.com/hub/Arch-Linux-Network-Setup-for-Beginners under "Available Network Interfaces"). There are all accesible network interfaces there in fact, loopback too. You can view them just using ls /sys/class/net (paste here the output if you still don't know wtf is this).

3. 4. 5. How do i edit !?
Have you ever looked at the code? I guess not, because changing sleeptime is very easy and intuitive I think... (Hint - there are important comments there too)

However you might still have problems with 4&5, you need to edit in script everything what is NOT bolded here:

./primeminer -poolip=$ip -poolport=$port -poolshare=6 -pooluser=DMy7cMjzWycNUB4FWz2YJEmh8EET2XDvqz -genproclimit="8" -sievesize="1000000" -sieveextensions="10" -sievepercentage="9" 2>&1 | tee -a $logkat/$filename &

./primeminer is a binary location. If you have it under /home/greekbitcoin/datatacoin/primeminer, then paste there this patch.
-poolshare=6 - no need to change with current pools.
-pooluser=DMy7cMjzWycNUB4FWz2YJEmh8EET2XDvqz - set your own address, lets say xxxxxxxxxxxxxxxxxxxx.
-genproclimit="8" - number of threads to use, lest say 2.
-sievesize="1000000" -sieveextensions="10" -sievepercentage="9" - well, cut this three out Tongue

So, you end up with:
/home/greekbitcoin/datatacoin/primeminer -poolip=$ip -poolport=$port -poolshare=6 -pooluser=xxxxxxxxxxxxxxxxxxxx -genproclimit="2" 2>&1 | tee -a $logkat/$filename &

(you can view sourcecode online: https://github.com/arkhebuz/datawatch/blob/master/datawatch.sh)
legendary
Activity: 1428
Merit: 1001
getmonero.org
I have a few vps running. And sometimes i put more. So i need this cause half of them stop over night. But i am too noob of linux to understand how this work Tongue

I mean i cant edit. I tried vi the file but then i cant do anything else Tongue How do i edit?

Btw i am using putty so i am always console mode.

also:

1.Do i really have to change the catalog that this stores the log files?
2.What about the network interface... Huh i am confused  Huh
3. 4. 5. How do i edit !?


Thanks Smiley

sr. member
Activity: 350
Merit: 250
DTC unofficial team
Great work!
I've sent you some DTC as a tip. Let's wait for feedbacks from the community!
newbie
Activity: 46
Merit: 0
Hi there. I've written DataMinerWatch as a solution for miner hangs during nighttime hours, when my PC have to operate autonomously, and recently decided to comment&clear the code and push it to Github. In this form script address three things:
  • Is Internet connection working at all? Script periodically pings few DNS servers and checks connection carrier, then writes info to logfile if less than half of packets is received.
  • Is miner running at all? If not, launch again.
  • Did miner hang somewhere at connection after all? I had hangs lasting an hour or two with lots of force reconnect if possible! or system:111 communicates, without any [MASTER] line printed to output. If script detects such behavior, primeminer is killed, launched (if in jump mode pool is changed) and info is written to logs.

Note that automatic pool switching on errors can save you from downtime caused by pool crash, as the second of two currently running Datacoin pools is in early beta stage and still a bit unstable.

Quick how-to
(If this post gets old and howto become broken, check github readme in case when I have updated something there but not here)
  • I'm assuming you have primeminer binary and basic linux skills. If not, google it, check this forum, peercointalk.org forum, etc.
  • Get dataminerwatch script, either copy-paste from github site or use git clone https://github.com/arkhebuz/datawatch command. Use chmod +x datawatch.sh to make the script executable if necessary.
  • Edit datawatch.sh file, all this is commented in code. What you need to do there:
    1. Change catalog where logs will be stored;
    2. Set your network interface virtual filesystem catalog (like /sys/class/net/eth0);
    3. Set interval in seconds between checks. Should be large enough to let the miner recover under its own steam in most cases. Also, too small will make script steal cpu cycles from miner;
    4. Set primeminer binary location;
    5. Edit primeminer launch parameters. This script is written with http://dtc.xpool.xram.co and http://dtc.gpool.net pools in mind, see my comments in code and check their sites;
  • Launch script, pass to it which pool and mode it should use, like ./datawatch.sh gpool stay.
  • There are two modes: "stay" and "jump". When stay (default) is used, script doesn't change the pool on connection hang. When jump is used, script will jump from one pool to another on hangs, constantly mining to the same Datacoin address. Currently xpool has 0.5 DTC payout barrier, while gpool 0.3 DTC.
  • You can launch it in terminal and just leave it on. I prefer keeping it inside GNU Screen, so I can easily attach it and kill when I need more computing power on my box, then relaunch when I'm done. In case of VPS you might want to keep script alive using supervisor, for example.

Quirks
  • Every primeminer run has it's own logfile with it's output, named with launch time (YYYY-MM-DD_hh.mm.ss). Additionally there's a netlog file, where only communicates from script about connection are stored.
  • In jump mode script should be able to change pool if miner can't connect at all to it at the very beginning, I hope.
  • Dependencies? Primeminer, pkill, pgrep, bash, grep, sed, ping... Nothing special.
  • Aha, works for me. May not work for you. Tested on Debian Wheezy.
  • Donate? Just a tip maybe?
    DTC: DMy7cMjzWycNUB4FWz2YJEmh8EET2XDvqz
    XPM: AV3w57CVmRdEA22qNiY5JFDx1J5wVUciBY
Jump to: