diff --git a/rc.local b/rc.local index 474b70b..3db476a 100644 --- a/rc.local +++ b/rc.local @@ -17,7 +17,7 @@ screen -dmS loop2 $WEB_DIR/loop2.sh screen -dmS blocks $WEB_DIR/blocks.sh screen -dmS debug tail -f $LOG_DIR/debug.log -# Stratum ports +# Stratum instances (skipped/exit if no .conf) screen -dmS c11 $STRATUM_DIR/run.sh c11 screen -dmS x11 $STRATUM_DIR/run.sh x11 diff --git a/stratum/config/run.sh b/stratum/config/run.sh index be3fe2a..c0039f3 100755 --- a/stratum/config/run.sh +++ b/stratum/config/run.sh @@ -4,7 +4,7 @@ ulimit -n 10240 ulimit -u 10240 cd /var/stratum -while true; do +while [ -e config/${1}.conf ]; do gzip -f config/${1}.log ./stratum config/$1 sleep 1 diff --git a/stratum/stratum.cpp b/stratum/stratum.cpp index f474499..b868dda 100644 --- a/stratum/stratum.cpp +++ b/stratum/stratum.cpp @@ -312,14 +312,17 @@ void *monitor_thread(void *p) exit(1); } - if(g_max_shares > 0 && g_shares_counter > g_max_shares) { - g_exiting = true; - stratumlog("%s need a restart, exiting...\n", g_current_algo->name); - exit(1); - } + if(g_max_shares && g_shares_counter) { - if((g_shares_counter % 10000u) == 0) { - stratumlog("%s %luK shares...\n", g_current_algo->name, (unsigned long) (g_shares_counter/10000u)); + if((g_shares_counter % 5000u) == 0) { + stratumlog("%s %luK shares...\n", g_current_algo->name, (g_shares_counter/10000u)); + } + + if(g_shares_counter > g_max_shares) { + g_exiting = true; + stratumlog("%s need a restart (%lu shares), exiting...\n", g_current_algo->name, g_max_shares); + exit(1); + } } } }