-
Notifications
You must be signed in to change notification settings - Fork 23
/
3main
1171 lines (1070 loc) · 35.3 KB
/
3main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
##########################################################################
##########################################################################
#################### nvOC 3.2 - Community Release ####################
########## Based on the original nvOC v0019-1.4 by fullzero ##########
##########################################################################
##########################################################################
# 3main for v0019-3.2
#
# Dev Mod Log:
#
# v=0001 : papampi and Stubo:
# bug fixes, code clean-up, optimizations and split into 2 files: 3main and 0miner
#
# v=0002 : leenoox
# bug fix - $pwr_lim_daggerhashimoto5 > $pwr_lim_daggerhashimoto
# bug fix - INDIVIDUAL settings were applied to GPU's 0-13 only. Fixed to work with 0-18
# code optimization
#
# v=0003 : leenoox
# added GPU LED Logo brightness control
#
# v=0004 : papampi
# Telegram Changes
#
# v=0005 : papampi
# Minor change on miner launch and output
#
# v=0006 : papampi
# Changes local watchdog and temp control start and guake output
# v=0007 : papampi
# Revert local miner to screen
# Launch wtm auto switch in screen
# v=0008 : papampi
# Local with wtm auto switch shows tail to prevent showing miner terminated
# v=0009 : papampi
# Added P104 and changed P106 to P10X
# v=0010 : papampi
# Download and Restore default xorg.conf
# v=0011 : papampi
# WTM 2nd lower minimum difference to switch
# v=0012 : LukePicchi
# Relocation and more
# v=0013 : papampi
# wipe dead screens
# v=0014 : LukePicci
# Relocate nvOC to arbitrary install directory
# v=0015 : papampi
# OhGodAnETHlargementPill for 1080 and 1080TI Ethahsh mining pill
# v=0016 : sizzlephizzle
# Declaration of ALGO
# v=0017 : LuKePicci
# Flexible and simplified OC policies
# v=0018 : papampi
# HEADLEAS_MODE and some code cleanups
# v=0019 : LuKePicci,papampi
# ${NVOC}/nvoc_logs tmpfs mount
# v=0020 : LuKePicci,papampi
# AUTO_SWITCH generalized implementetion
# v=0021 : papampi
# Algo identification edits for Algo mining unification
# v=0022 : LuKePicci
# Reworked OC PerfLevel detection, 0algo_id
# v=0023 : papampi
# Fix XMR cpu miner
# v=0024 : LuKePicci
# Support CUDA version selection
# v=0025 : LuKePicci
# Support pluggable miners
# v=0026 : Spiral
# Set resolution from 1bash for teamviewer usage
# v=0027 : papampi
# Add Foreman Monitor
# v=0028 : papampi
# Miner Schedule
# v=0029 : papampi
# eth-pill opts
source ${NVOC}/1bash
nvOC_3main_Dev="0029"
nvOC_3main_ver="$nvOC_ver.$nvOC_3main_Dev" # Do not edit this
#########################################################################
#########################################################################
#########################################################################
#########################################################################
echo ""
echo " $nvOC_ver "
echo ""
echo ""
sudo ldconfig /usr/local/cuda/lib64
GPUS=$(nvidia-smi -i 0 --query-gpu=count --format=csv,noheader,nounits)
NVD=nvidia-settings
screen -wipe
if [[ $SSH == YES ]]
then
sudo cp /etc/init/ssh.conf-on /etc/init/ssh.conf
fi
if [[ $SSH == NO ]]
then
sudo cp /etc/init/ssh.conf-off /etc/init/ssh.conf
fi
if [[ $TEAMVIEWER == YES ]]
then
running=$(ps -ef | awk '$NF~"teamviewer" {print $2}')
if [ "$running" == "" ]
then
sudo teamviewer --daemon enable
sleep 2
guake -n teamviewer -r teamviewer -e "teamviewer" &
sleep 1
running=""
if [[ $RESOLUTION != "" ]]
then
echo "Setting resolution to $RESOLUTION"
xrandr --fb $RESOLUTION
echo ""
fi
fi
fi
if [[ $SRR == YES ]]
then
sleep 2
HCD=${NVOC}/SRR
if ! ps ax | grep -q '[S]RR'; then
guake -n $HCD -r SRR -e "bash ${NVOC}/SRR" &
sleep 1
fi
fi
if [[ $CLEAR_LOGS_ON_BOOT == YES ]]
then
sudo bash "${NVOC}/clear_logs"
fi
export DISPLAY=:0
if [[ $LOG_ROTATE == YES ]]
then
HCD="${NVOC}/log_rotate"
if ! ps ax | grep -q '[l]og_rotate'
then
guake -n $HCD -r LOG_ROTATE -e "bash ${NVOC}/log_rotate" &
sleep 1
fi
fi
if [[ $MINER_SCHEDULE == YES ]]
then
HCD="${NVOC}/7miner_schedule"
if ! ps ax | grep -v grep | grep -q '7miner_schedule'
then
guake -n $HCD -r SCHEDULE -e "bash ${NVOC}/7miner_schedule" &
sleep 1
fi
fi
if [[ $LOAD_CHECK == YES ]]
then
HCD="${NVOC}/7load_check"
if ! ps ax | grep -v grep | grep -q '7load_check'
then
guake -n $HCD -r LOAD_CHK -e "bash ${NVOC}/7load_check" &
sleep 1
fi
fi
if [ ! -f ${NVOC}/nvoc_logs/tempa ]
then
nvidia-smi -L > ${NVOC}/nvoc_logs/tempa
fi
if grep -q -E 'P104|P102' ${NVOC}/nvoc_logs/tempa; then
GPU_OC_PROFILE="1 ${GPU_OC_PROFILE}"
fi
if grep -q -E "1050|P106" ${NVOC}/nvoc_logs/tempa; then
GPU_OC_PROFILE="2 ${GPU_OC_PROFILE}"
fi
if grep -q -E '1060|1070|1080' ${NVOC}/nvoc_logs/tempa; then
GPU_OC_PROFILE="3 ${GPU_OC_PROFILE}"
fi
XORG="FAIL"
if [[ $HEADLESS_MODE == YES ]]
then
if ! grep -q "XORG_UPDATED" ${NVOC}/xorg_flag;
then
sudo nvidia-xconfig -a --enable-all-gpus --allow-empty-initial-configuration --cool-bits=28
echo XORG_UPDATED > "${NVOC}/xorg_flag"
sleep 4
echo "XORG UPDATED"
echo ""
echo "Rebooting in 5"
echo ""
echo "disconnect monitor if connected"
sleep 5
sudo reboot
fi
XORG="OK"
fi
if grep -q "28800" /etc/X11/xorg.conf;
then
XORG="OK"
fi
# dev note by leenoox:
# we need to create function for this:
if [[ $SLOW_USB_KEY_MODE == YES ]]
then
sleep 6
fi
if [[ $XORG == FAIL ]]
then
echo ""
echo "Xorg PROBLEM DETECTED"
echo ""
echo "Restoring Xorg"
echo ""
if [[ -e ${NVOC}/xorg.conf.default ]]
then
echo "Restore default xorg.conf"
sudo cp ${NVOC}/xorg.conf.default /etc/X11/xorg.conf.default
else
echo "Downloading default xorg.conf"
wget -N https://raw.githubusercontent.com/papampi/nvOC_by_fullzero_Community_Release/3.0-stable/xorg.conf.default -O /tmp/xorg.conf.default
echo "Restore default xorg.conf"
sudo cp /tmp/xorg.conf.default /etc/X11/xorg.conf.default
fi
sudo cp /etc/X11/xorg.conf.default /etc/X11/xorg.conf
echo "Rebooting in 5 seconds"
sleep 5
sudo reboot
fi
# install web scripts
mkdir -p "${HOME}/www/cgi-bin"
for webscript in minerinfo
do
if [[ -L "$HOME/www/cgi-bin/$webscript" ]]
then
rm "$HOME/www/cgi-bin/$webscript"
fi
if [[ ! -e "$HOME/www/cgi-bin/$webscript" ]]
then
ln -s "${NVOC}/www/cgi-bin/$webscript" "${HOME}/www/cgi-bin/$webscript"
chmod +x "${HOME}/www/cgi-bin/$webscript"
fi
done
IP=$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')
echo ""
echo ""
echo "rig IP: $IP"
echo ""
echo ""
echo "rig MAC: $MAC"
if [[ $SLOW_USB_KEY_MODE == YES ]]
then
sleep 6
fi
echo ""
echo ""
lspci | grep VGA
if [[ $SLOW_USB_KEY_MODE == YES ]]
then
sleep 6
fi
if [[ $LOCALorREMOTE == LOCAL ]]
then
echo ""
echo ""
# Just print out some info in the terminal
nvidia-smi
echo ""
if [[ $SLOW_USB_KEY_MODE == YES ]]
then
sleep 6
fi
fi
if [[ $USE_ENVIRONMENTAL_VARIBLES == YES ]]
then
export GPU_FORCE_64BIT_PTR="0"
export GPU_MAX_HEAP_SIZE="100"
export GPU_USE_SYNC_OBJECTS="1"
export GPU_MAX_ALLOC_PERCENT="100"
echo ""
echo ENVIRONMENTAL VARIBLES SET
fi
if [[ $AUTO_REBOOT == YES ]]
then
HCD="${NVOC}/7reboot"
if ! ps ax | grep -q '[7]reboot'
then
guake -n $HCD -r AUTO_REBOOT -e "bash ${NVOC}/7reboot" &
sleep 1
fi
fi
if [[ $MINER_RESTART == YES ]]
then
HCD="${NVOC}/7miner_restart"
if ! ps ax | grep -q '[7]miner_restart'
then
guake -n $HCD -r MINER_RESTART -e "bash ${NVOC}/7miner_restart" &
sleep 1
fi
fi
if [[ $_Parallax_MODE == YES ]]
then
HCD="${NVOC}/upPASTE"
if ! ps ax | grep -q '[u]pPASTE'
then
echo ""
echo ""
echo "LAUNCHING: _Parallax_and_lost_post_upPASTE"
echo ""
echo "process in guake terminal Tab (f12)"
echo ""
guake -n $HCD -r PX_LP_upPASTE -e "bash ${NVOC}/upPASTE" &
sleep 1
fi
fi
sleep 2
if [[ $FOREMAN_MONITOR == YES ]]
then
echo "Running with Foreman integration"
FOREMAN_NVOC=$NVOC/foreman
source $FOREMAN_NVOC/package.sh
# Verify that the user's client ID and API key are defined
if [[ -z $FOREMAN_CLIENT_ID || -z $FOREMAN_API_KEY ]]
then
echo "Either your FOREMAN_CLIENT_ID or FOREMAN_API_KEY haven't been set - check your 1bash"
else
FOREMAN_HOME=~/.foreman
FOREMAN_PICKAXE_ID=$(frmn_get_pickaxe_id)
if [[ -z $FOREMAN_PICKAXE_ID ]]
then
# No pickaxe ID - create one for this rig
FOREMAN_PICKAXE_ID=$(frmn_create_pickaxe)
fi
# Is a Foreman upgrade needed?
if [[ "$(frmn_get_current_pickaxe_version)" != "$(frmn_get_latest_pickaxe_version)" || "$(frmn_get_current_chisel_version)" != "$(frmn_get_latest_chisel_version)" ]]
then
# Upgrade needed
echo "Upgrading Foreman to latest version"
# Download and run the install/upgrade script
wget https://gist.githubusercontent.com/delawr0190/8cb40ab12c9f784d88b80d105e69933b/raw/install.sh \
-o /dev/null \
--no-check-certificate \
-q \
-O $FOREMAN_NVOC/foreman-install
chmod +x $FOREMAN_NVOC/foreman-install
export FOREMAN_HOME
sudo -E bash $FOREMAN_NVOC/foreman-install pickaxe $FOREMAN_CLIENT_ID $FOREMAN_API_KEY $FOREMAN_PICKAXE_ID
sudo -E bash $FOREMAN_NVOC/foreman-install chisel
sudo chown -R $(logname):$(logname) $FOREMAN_HOME
# Script is no longer needed
rm $FOREMAN_NVOC/foreman-install
fi
# Start everything
$FOREMAN_HOME/chisel/bin/chisel.sh restart
$FOREMAN_HOME/pickaxe/bin/pickaxe.sh restart
$FOREMAN_NVOC/miner-watch &
fi
fi
if [[ $TEAMVIEWER == NO ]]
then
running=$(ps -ef | awk '$NF~"teamviewer" {print $2}')
if [ "$running" != "" ]
then
sudo teamviewer --daemon disable
sleep 2
running=""
fi
fi
if [[ $MINER_TEMP_CONTROL == YES ]]
then
if ps ax | grep -q '[6]tempcontrol'; then
ps -ef | awk '$NF~"6tempcontrol" {print $2}' | xargs kill
fi
sleep 2
echo ""
if ! ps ax | grep -q '[6]tempcontrol'; then
echo "LAUNCHING: MINER TEMPCONTROL"
screen -c ${NVOC}/screenrc-tempcontrol -dmSL temp bash ${NVOC}/6tempcontrol
echo ""
if [[ $LOCALorREMOTE == LOCAL ]]; then
echo "process in screen temp, guake terminal Tab (f12), 'nvOC temp-log'"
#if guake tab is already showing temp control output dont open a new one
if ! ps ax | grep "tail -n 0 -f ${NVOC}/nvoc_logs/[t]empcontrol-screenlog.0"; then
guake -n ${NVOC}/6tempcontrol -r MINER_TEMP_CONTROL -e "tail -n 0 -f ${NVOC}/nvoc_logs/tempcontrol-screenlog.0" &
sleep 1
fi
elif [[ $LOCALorREMOTE == REMOTE ]]; then
echo "process in screen temp; 'nvOC temp-log'"
fi
echo ""
fi
fi
if [[ $TELEGRAM_MESSAGES == YES ]]
then
HCD="${NVOC}/7telegram"
if ! ps ax | grep -q '[7]telegram'
then
guake -n $HCD -r TELEGRAM_MESSAGES -e "bash ${NVOC}/7telegram" &
sleep 1
running=""
fi
fi
if (( FAN_SPEED < 40 ))
then
FAN_SPEED=40
fi
if [[ $WTM_PROFIT_CHECK == YES && $AUTO_SWITCH != WTM_SWITCHING ]]
then
echo ""
echo "LAUNCHING: WTM PROFIT CHECK "
echo ""
cat <<EOF >${NVOC}/WTM.json
{
"output_dir": "${NVOC}",
"WTM_URL": "$WTM_AUTO_SWITCH_URL",
"WTM_COINS": "$WTM_AUTO_SWITCH_COINS",
"WTM_MIN_DIFFERENCE": "$WTM_MIN_DIFFERENCE",
"currency":"$WTM_CURRENCY"
}
EOF
HCD="${NVOC}/8wtm_profit_check"
if ! ps ax | grep -q '[8]wtm_profit_check'
then
guake -n $HCD -r WTM_PROFIT_CHECK -e "bash ${NVOC}/8wtm_profit_check" &
sleep 1
running=""
fi
fi
if [[ ${AUTO_SWITCH:0:7} == SALFTER ]]
then
NICE_ALGO_NAMES="cryptonight cryptonightv7 daggerhashimoto lbry lyra2rev2"
MPH_ALGO_NAMES="cryptonight_monero ethash groestl lyra2re2 myriad_groestl skein"
SHARED_ALGO_NAMES="equihash keccak neoscrypt qubit scrypt sia x11"
for a in $NICE_ALGO_NAMES $MPH_ALGO_NAMES $SHARED_ALGO_NAMES
do
checkdef=${a}_POWERLIMIT_WATTS
if [[ ${!checkdef} == "" ]]
then
eval ${a}_POWERLIMIT_WATTS=$_POWERLIMIT_WATTS
fi
if [[ $POWERLIMIT_MODE == GLOBAL_with_GPU_OFFSET ]]
then
eval pwr_lim_$a="[$(seq 0 $((GPUS-1)) | sed -e 's/^/\$((_POWERLIMIT_WATTS+INDIVIDUAL_POWERLIMIT_/' -e 's/$/))/' | paste -s -d, -)]"
elif [[ $POWERLIMIT_MODE == GPU_SPECIFIC ]]
then
eval pwr_lim_$a="[$(seq 0 $((GPUS-1)) | sed -e 's/^/\${INDIVIDUAL_POWERLIMIT_/' -e 's/$/}/' | paste -s -d, -)]"
elif [[ $POWERLIMIT_MODE == ALGO_SPECIFIC ]]
then
eval pwr_lim_$a=$((${a}_POWERLIMIT_WATTS))
elif [[ $POWERLIMIT_MODE == ALGO_SPECIFIC_with_GPU_OFFSET ]]
then
eval pwr_lim_$a="[$(seq 0 $((GPUS-1)) | sed -e 's/^/\$((${a}_POWERLIMIT_WATTS+INDIVIDUAL_POWERLIMIT_/' -e 's/$/))/' | paste -s -d, -)]"
else
if [[ $POWERLIMIT_MODE != GLOBAL ]]
then
echo "WARNING: '$POWERLIMIT_MODE' is not a valid powerlimit mode, falling back to 'GLOBAL'"
fi
eval pwr_lim_$a=$_POWERLIMIT_WATTS
fi
checkdef=${a}_CORE_OVERCLOCK
if [[ ${!checkdef} == "" ]]
then
eval ${a}_CORE_OVERCLOCK=$_CORE_OVERCLOCK
fi
checkdef=${a}_MEMORY_OVERCLOCK
if [[ ${!checkdef} == "" ]]
then
eval ${a}_MEMORY_OVERCLOCK=$_MEMORY_OVERCLOCK
fi
if [[ $OVERCLOCK_MODE == GLOBAL ]]
then
eval gpu_clks_$a=$_CORE_OVERCLOCK
eval mem_clks_$a=$_MEMORY_OVERCLOCK
elif [[ $OVERCLOCK_MODE == GLOBAL_with_GPU_OFFSET ]]
then
eval gpu_clks_$a="[$(seq 0 $((GPUS-1)) | sed -e 's/^/\$((_CORE_OVERCLOCK + __CORE_OVERCLOCK_/' -e 's/$/))/' | paste -s -d, -)]"
eval mem_clks_$a="[$(seq 0 $((GPUS-1)) | sed -e 's/^/\$((_MEMORY_OVERCLOCK + MEMORY_OVERCLOCK_/' -e 's/$/))/' | paste -s -d, -)]"
elif [[ $OVERCLOCK_MODE == GPU_SPECIFIC ]]
then
eval gpu_clks_$a="[$(seq 0 $((GPUS-1)) | sed -e 's/^/\${__CORE_OVERCLOCK_/' -e 's/$/}/' | paste -s -d, -)]"
eval mem_clks_$a="[$(seq 0 $((GPUS-1)) | sed -e 's/^/\${MEMORY_OVERCLOCK_/' -e 's/$/}/' | paste -s -d, -)]"
elif [[ $OVERCLOCK_MODE == ALGO_SPECIFIC ]]
then
eval gpu_clks_$a=$((${a}_CORE_OVERCLOCK))
eval mem_clks_$a=$((${a}_MEMORY_OVERCLOCK))
elif [[ $OVERCLOCK_MODE == ALGO_SPECIFIC_with_GPU_OFFSET ]]
then
eval gpu_clks_$a="[$(seq 0 $((GPUS-1)) | sed -e 's/^/\$((${a}_CORE_OVERCLOCK + __CORE_OVERCLOCK_/' -e 's/$/))/' | paste -s -d, -)]"
eval mem_clks_$a="[$(seq 0 $((GPUS-1)) | sed -e 's/^/\$((${a}_MEMORY_OVERCLOCK + MEMORY_OVERCLOCK_/' -e 's/$/))/' | paste -s -d, -)]"
else
if [[ $OVERCLOCK_MODE != NO ]]
then
echo "WARNING: '$OVERCLOCK_MODE' is not a valid overclock mode, falling back to 'NO'"
fi
eval gpu_clks_$a=0
eval mem_clks_$a=0
fi
done
POWERLIMIT_MODE="MANAGED_BY_SWITCHER"
OVERCLOCK_MODE="MANAGED_BY_SWITCHER"
fi
if [[ $AUTO_SWITCH == SALFTER_NICEHASH_SWITCHING ]]
then
if ! grep -q "api.nicehash.com" /etc/hosts
then
cp -f /etc/hosts /tmp/hosts.edited
echo "104.20.158.21 api.nicehash.com" >> /tmp/hosts.edited
sudo cp -f /tmp/hosts.edited /etc/hosts
echo UPDATED HOSTS FILE WITH IPv6 FIX
echo ""
echo ""
sleep 2
fi
cat <<EOF >${NVOC}/nice_conf.json
{
"output_dir": "${NVOC}",
"currency": "$CURRENCY",
"pwrcost": $POWER_COST,
"min_profit": $MINIMUM_PROFIT,
"payment_addr": "$PAYMENT_ADDRESS",
"miner_name": "$WORKER_NAME",
"performance":
{
"daggerhashimoto": {
"speed": 0.087, "power": 0.397,
"power_limit": $pwr_lim_daggerhashimoto, "gpu_oc": $gpu_clks_daggerhashimoto, "mem_oc": $mem_clks_daggerhashimoto, "fan": 0,
"cmd": "${NVOC}/miners/ETHMINER/recommended/ethminer -SP 2 -S daggerhashimoto.usa.nicehash.com:3353 -O {ADDR}.{MINER}:x -U"
},
"equihash": {
"speed": 0.000001140, "power": 0.397,
"power_limit": $pwr_lim_equihash, "gpu_oc": $gpu_clks_equihash, "mem_oc": $mem_clks_equihash, "fan": 0,
"cmd": "${NVOC}/miners/EWBF/recommended/miner --eexit 3 --fee 0 --pec --server equihash.usa.nicehash.com --user {ADDR}.{MINER} --pass z --port 3357"
},
"neoscrypt": {
"speed": 0.002160, "power": 0.397,
"power_limit": $pwr_lim_neoscrypt, "gpu_oc": $gpu_clks_neoscrypt, "mem_oc": $mem_clks_neoscrypt, "fan": 0,
"cmd": "${NVOC}/miners/CryptoDredge/recommended/CryptoDredge -a neoscrypt -o stratum+tcp://neoscrypt.usa.nicehash.com:3341 -u {ADDR}.{MINER} -p x"
},
"lyra2rev2": {
"speed": 0.081, "power": 0.386,
"power_limit": $pwr_lim_lyra2rev2, "gpu_oc": $gpu_clks_lyra2rev2, "mem_oc": $mem_clks_lyra2rev2, "fan": 0,
"cmd": "${NVOC}/miners/CryptoDredge/recommended/CryptoDredge -a lyra2v2 -o stratum+tcp://lyra2rev2.usa.nicehash.com:3347 -u {ADDR}.{MINER} -p x"
},
"lbry": {
"speed": 0.639, "power": 0.392,
"power_limit": $pwr_lim_lbry, "gpu_oc": $gpu_clks_lbry, "mem_oc": $mem_clks_lbry, "fan": 0,
"cmd": "${NVOC}/miners/TPccminer/recommended/ccminer -a lbry -o stratum+tcp://lbry.usa.nicehash.com:3356 -u {ADDR}.{MINER} -p x"
}
}
}
EOF
AUTO_SWITCH_CMD="python2.7 ${NVOC}/nice_switch ${NVOC}/nice_conf.json"
fi
# END SALFTER_NICEHASH_SWITCHING #
if [[ $AUTO_SWITCH == SALFTER_MPH_SWITCHING ]]
then
cat <<EOF >${NVOC}/mph_conf.json
{
"output_dir": "${NVOC}",
"user_name": "$MPH_USERNAME",
"miner_name": "$WORKER_NAME",
"card_type": "nvidia",
"currency": "$CURRENCY",
"pwrcost": $POWER_COST,
"min_profit": $MINIMUM_PROFIT,
"miners":
{
"Cryptonight-Monero":
{
"bin": "${NVOC}/miners/XMR_Stak/recommended/xmr-stak --currency monero7 --noCPU --noAMD -o {HOST}:{PORT} -u {NAME}.{MINER} -p x -i 0",
"power_limit": $pwr_lim_cryptonight_monero, "gpu_oc": $gpu_clks_cryptonight_monero, "mem_oc": $mem_clks_cryptonight_monero, "fan": 0,
"speed": 0.000002, "power": 0.325
},
"Equihash":
{
"bin": "${NVOC}/miners/EWBF/recommended/miner --eexit 3 --fee 0 --pec --server {HOST} --user {NAME}.{MINER} --pass z --port {PORT}",
"power_limit": $pwr_lim_equihash, "gpu_oc": $gpu_clks_equihash, "mem_oc": $mem_clks_equihash, "fan": 0,
"speed": 0.000001140, "power": 0.397
},
"Ethash":
{
"bin": "${NVOC}/miners/ETHMINER/recommended/ethminer -S {HOST}:{PORT} -O {NAME}.{MINER}:x -U",
"power_limit": $pwr_lim_ethash, "gpu_oc": $gpu_clks_ethash, "mem_oc": $mem_clks_ethash, "fan": 0,
"speed": 0.087, "power": 0.397
},
"Groestl":
{
"bin": "${NVOC}/miners/TPccminer/recommended/ccminer -a groestl -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x",
"power_limit": $pwr_lim_groestl, "gpu_oc": $gpu_clks_groestl, "mem_oc": $mem_clks_groestl, "fan": 0,
"speed": 0.0853, "power": 0.392
},
"Keccak":
{
"bin": "${NVOC}/miners/TPccminer/recommended/ccminer -a keccak -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x",
"power_limit": $pwr_lim_keccak, "gpu_oc": $gpu_clks_keccak, "mem_oc": $mem_clks_keccak, "fan": 0,
"speed": 1.45, "power": 0.391
},
"Lyra2RE2":
{
"bin": "${NVOC}/miners//CryptoDredge/recommended/CryptoDredge -a lyra2v2 -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x",
"power_limit": $pwr_lim_lyra2re2, "gpu_oc": $gpu_clks_lyra2re2, "mem_oc": $mem_clks_lyra2re2, "fan": 0,
"speed": 0.081, "power": 0.386
},
"Myriad-Groestl":
{
"bin": "${NVOC}/miners/TPccminer/recommended/ccminer -a myr-gr -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x",
"power_limit": $pwr_lim_myriad_groestl, "gpu_oc": $gpu_clks_myriad_groestl, "mem_oc": $mem_clks_myriad_groestl, "fan": 0,
"speed": 0.158, "power": 0.391
},
"NeoScrypt":
{
"bin": "${NVOC}/miners/CryptoDredge/recommended/CryptoDredge -a neoscrypt -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x",
"power_limit": $pwr_lim_neoscrypt, "gpu_oc": $gpu_clks_neoscrypt, "mem_oc": $mem_clks_neoscrypt, "fan": 0,
"speed": 0.002160, "power": 0.397
},
"Qubit":
{
"bin": "${NVOC}/miners/TPccminer/recommended/ccminer -a qubit -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x",
"power_limit": $pwr_lim_qubit, "gpu_oc": $gpu_clks_qubit, "mem_oc": $mem_clks_qubit, "fan": 0,
"speed": 0.0509, "power": 0.382
},
"Scrypt":
{
"bin": "${NVOC}/miners/TPccminer/recommended/ccminer -a scrypt -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x",
"power_limit": $pwr_lim_scrypt, "gpu_oc": $gpu_clks_scrypt, "mem_oc": $mem_clks_scrypt, "fan": 0,
"speed": 0.00224, "power": 0.403
},
"Sia":
{
"bin": "${NVOC}/miners/TPccminer/recommended/ccminer -a sia -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x",
"power_limit": $pwr_lim_sia, "gpu_oc": $gpu_clks_sia, "mem_oc": $mem_clks_sia, "fan": 0,
"speed": 3.700, "power": 0.403
},
"Skein":
{
"bin": "${NVOC}/miners/TPccminer/recommended/ccminer -a skein -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x",
"power_limit": $pwr_lim_skein, "gpu_oc": $gpu_clks_skein, "mem_oc": $mem_clks_skein, "fan": 0,
"speed": 0.835, "power": 0.383
},
"X11":
{
"bin": "${NVOC}/miners/TPccminer/recommended/ccminer -a x11 -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x",
"power_limit": $pwr_lim_x11, "gpu_oc": $gpu_clks_x11, "mem_oc": $mem_clks_x11, "fan": 0,
"speed": 0.0327, "power": 0.403
}
}
}
EOF
AUTO_SWITCH_CMD="python2.7 ${NVOC}/mph_switch ${NVOC}/mph_conf.json"
fi
# END SALFTER_MPH_SWITCHING #
if [[ $AUTO_SWITCH == SALFTER_PROGRAMATIC_SWITCHING ]]
then
cat <<EOF >${NVOC}/programatic_conf.json
{
"output_dir": "${NVOC}",
"card_type": "nvidia",
"config_json_url": "$PROGRAMATIC_SWITCH_CONFIG_JSON_URL",
"miners":
{
"Cryptonight":
{
"bin": "${NVOC}/miners/KTccminer_cryptonight/recommended/ccminer -o stratum+tcp://{HOST}:{PORT} -u {NAME} -p x",
"power_limit": $pwr_lim_cryptonight, "gpu_oc": $gpu_clks_cryptonight, "mem_oc": $mem_clks_cryptonight, "fan": 0
},
"Cryptonight-Monero":
{
"bin": "${NVOC}/miners/XMR_Stak/recommended/xmr-stak --currency monero7 --noCPU --noAMD -o {HOST}:{PORT} -u {NAME}.{MINER} -p x -i 0",
"power_limit": $pwr_lim_cryptonight_monero, "gpu_oc": $gpu_clks_cryptonight_monero, "mem_oc": $mem_clks_cryptonight_monero, "fan": 0
},
"Cryptonight-Heavy":
{
"bin": "${NVOC}/miners/XMR_Stak/recommended/xmr-stak -a cryptonight-heavy --noCPU --noAMD -o {HOST}:{PORT} -u {NAME} -p x -k",
"power_limit": $pwr_lim_cryptonight, "gpu_oc": $gpu_clks_cryptonight, "mem_oc": $mem_clks_cryptonight, "fan": 0
},
"Equihash":
{
"bin": "${NVOC}/miners/DSTM/recommended/miner --server {HOST} --port {PORT} --user {NAME}.{MINER} --pass x --telemetry=0.0.0.0:2222 --time --color",
"power_limit": $pwr_lim_equihash, "gpu_oc": $gpu_clks_equihash, "mem_oc": $mem_clks_equihash, "fan": 0
},
"Ethash":
{
"bin": "${NVOC}/miners/ETHMINER/recommended/ethminer -S {HOST}:{PORT} -O {NAME}.{MINER}:x -U",
"power_limit": $pwr_lim_ethash, "gpu_oc": $gpu_clks_ethash, "mem_oc": $mem_clks_ethash, "fan": 0
},
"Groestl":
{
"bin": "${NVOC}/miners/TPccminer/recommended/ccminer -a groestl -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x -p c={COIN_CURRENCY}",
"power_limit": $pwr_lim_groestl, "gpu_oc": $gpu_clks_groestl, "mem_oc": $mem_clks_groestl, "fan": 0
},
"Keccak":
{
"bin": "${NVOC}/miners/TPccminer/recommended/ccminer -a keccak -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x -p c={COIN_CURRENCY}",
"power_limit": $pwr_lim_keccak, "gpu_oc": $gpu_clks_keccak, "mem_oc": $mem_clks_keccak, "fan": 0
},
"Lyra2RE2":
{
"bin": "${NVOC}/miners/CryptoDredge/recommended/CryptoDredge -a lyra2v2 -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x -p c={COIN_CURRENCY}",
"power_limit": $pwr_lim_lyra2re2, "gpu_oc": $gpu_clks_lyra2re2, "mem_oc": $mem_clks_lyra2re2, "fan": 0
},
"Myriad-Groestl":
{
"bin": "${NVOC}/miners/TPccminer/recommended/ccminer -a myr-gr -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x -p c={COIN_CURRENCY}",
"power_limit": $pwr_lim_myriad_groestl, "gpu_oc": $gpu_clks_myriad_groestl, "mem_oc": $mem_clks_myriad_groestl, "fan": 0
},
"NeoScrypt":
{
"bin": "${NVOC}/miners/CryptoDredge/recommended/CryptoDredge -a neoscrypt -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x -p c={COIN_CURRENCY}",
"power_limit": $pwr_lim_neoscrypt, "gpu_oc": $gpu_clks_neoscrypt, "mem_oc": $mem_clks_neoscrypt, "fan": 0
},
"Qubit":
{
"bin": "${NVOC}/miners/TPccminer/recommended/ccminer -a qubit -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x -p c={COIN_CURRENCY}",
"power_limit": $pwr_lim_qubit, "gpu_oc": $gpu_clks_qubit, "mem_oc": $mem_clks_qubit, "fan": 0
},
"Scrypt":
{
"bin": "${NVOC}/miners/TPccminer/recommended/ccminer -a scrypt -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x -p c={COIN_CURRENCY}",
"power_limit": $pwr_lim_scrypt, "gpu_oc": $gpu_clks_scrypt, "mem_oc": $mem_clks_scrypt, "fan": 0
},
"Sia":
{
"bin": "${NVOC}/miners/TPccminer/recommended/ccminer -a sia -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x -p c={COIN_CURRENCY}",
"power_limit": $pwr_lim_sia, "gpu_oc": $gpu_clks_sia, "mem_oc": $mem_clks_sia, "fan": 0
},
"Skein":
{
"bin": "${NVOC}/miners/TPccminer/recommended/ccminer -a skein -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x -p c={COIN_CURRENCY}",
"power_limit": $pwr_lim_skein, "gpu_oc": $gpu_clks_skein, "mem_oc": $mem_clks_skein, "fan": 0
},
"X11":
{
"bin": "${NVOC}/miners/TPccminer/recommended/ccminer -a x11 -o stratum+tcp://{HOST}:{PORT} -u {NAME}.{MINER} -p x -p c={COIN_CURRENCY}",
"power_limit": $pwr_lim_x11, "gpu_oc": $gpu_clks_x11, "mem_oc": $mem_clks_x11, "fan": 0
}
}
}
EOF
AUTO_SWITCH_CMD="python2.7 ${NVOC}/programatic_switch ${NVOC}/programatic_conf.json"
fi
# END SALFTER_PROGRAMATIC_SWITCHING #
if [[ $AUTO_SWITCH == WTM_SWITCHING ]]
then
echo ""
echo "LAUNCHING: WTM AUTO SWITCH "
echo ""
cat <<EOF >${NVOC}/WTM.json
{
"output_dir": "${NVOC}",
"WTM_URL": "$WTM_AUTO_SWITCH_URL",
"WTM_COINS": "$WTM_AUTO_SWITCH_COINS",
"WTM_MIN_DIFFERENCE": "$WTM_MIN_DIFFERENCE",
"currency":"$WTM_CURRENCY"
}
EOF
cat <<EOF >${NVOC}/WTM_1.json
{
"output_dir": "${NVOC}",
"WTM_URL": "$WTM_AUTO_SWITCH_URL",
"WTM_COINS": "$WTM_AUTO_SWITCH_COINS",
"WTM_MIN_DIFFERENCE": "$WTM_LOWER_MIN_DIFFERENCE",
"currency":"$WTM_CURRENCY"
}
EOF
if ! ps ax | grep -q '[8]wtm_auto_switch'
then
screen -c ${NVOC}/screenrc-wtm -dmSL wtm bash ${NVOC}/8wtm_auto_switch
if [[ $LOCALorREMOTE == LOCAL ]]; then
echo ""
echo "process in screen wtm, guake terminal Tab (f12)"
if ! ps ax | grep "tail -n 0 -f ${NVOC}/nvoc_logs/[8]_wtmautoswitchlog"; then
guake -n ${NVOC}/8wtm_auto_switch -r WTM_SWITCHING -e "tail -n 0 -f ${NVOC}/nvoc_logs/8_wtmautoswitchlog" &
sleep 1
fi
elif [[ $LOCALorREMOTE == REMOTE ]]; then
echo "process in screen wtm, 'nvOC wtm-log'"
echo " "
fi
fi
else
pkill -f 8wtm_auto_switch
fi
source ${NVOC}/helpers/coin_algo_mapping
UNDEFINED_POWERLIMIT_WATTS=$_POWERLIMIT_WATTS
if [[ $POWERLIMIT_MODE == GLOBAL ]]
then
sudo nvidia-smi -pl "$_POWERLIMIT_WATTS"
elif [[ $POWERLIMIT_MODE == GPU_SPECIFIC ]]
then
for i in $(seq 0 $((GPUS-1)))
do
sudo nvidia-smi -i $i -pl $((INDIVIDUAL_POWERLIMIT_$i))
done
elif [[ $POWERLIMIT_MODE == ALGO_SPECIFIC ]]
then
for i in $(seq 0 $((GPUS-1)))
do
sudo nvidia-smi -i $i -pl $((${ALGO}_POWERLIMIT_WATTS))
done
elif [[ $POWERLIMIT_MODE == GLOBAL_with_GPU_OFFSET ]]
then
for i in $(seq 0 $((GPUS-1)))
do
sudo nvidia-smi -i $i -pl $((_POWERLIMIT_WATTS + INDIVIDUAL_POWERLIMIT_$i))
done
elif [[ $POWERLIMIT_MODE == ALGO_SPECIFIC_with_GPU_OFFSET ]]
then
for i in $(seq 0 $((GPUS-1)))
do
sudo nvidia-smi -i $i -pl $((${ALGO}_POWERLIMIT_WATTS + INDIVIDUAL_POWERLIMIT_$i))
done
elif [[ $POWERLIMIT_MODE == MANAGED_BY_SWITCHER ]]
then
echo "INFO: An auto-switcher is taking over GPU Power Limit settings management."
echo
else
echo "WARNING: '$POWERLIMIT_MODE' is not a valid powerlimit mode, falling back to 'GLOBAL'"
sudo nvidia-smi -pl "$_POWERLIMIT_WATTS"
fi
if [[ $OhGodAnETHlargementPill == YES && $ALGO == ETHASH ]]
then
echo " Launching OhGodAnETHlargementPill"
HCD="${NVOC}/OhGodAnETHlargementPill-r2 $OhGodAnETHlargementPill_OPTS"
chmod a+x "${NVOC}/OhGodAnETHlargementPill-r2"
if ! ps ax | grep -q '[O]hGodAnETHlargementPill'
then
screen -dmS eth_pill sudo $HCD
if [[ $LOCALorREMOTE == LOCAL ]]
then
guake -n $HCD -r ETH_PILL -e "screen -r eth_pill" &
sleep 1
fi
fi
else
pkill -f OhGodAnETHlargementPill-r2
fi
UNDEFINED_CORE_OVERCLOCK=$_CORE_OVERCLOCK
UNDEFINED_MEMORY_OVERCLOCK=$_MEMORY_OVERCLOCK
if [[ $OVERCLOCK_MODE == GLOBAL ]]
then
for i in $(seq 0 $((GPUS-1)))
do
__CORE_OVERCLOCK[$i]=$_CORE_OVERCLOCK
MEMORY_OVERCLOCK[$i]=$_MEMORY_OVERCLOCK
done
elif [[ $OVERCLOCK_MODE == GLOBAL_with_GPU_OFFSET ]]
then
for i in $(seq 0 $((GPUS-1)))
do
__CORE_OVERCLOCK[$i]=$(( _CORE_OVERCLOCK + __CORE_OVERCLOCK_$i ))
MEMORY_OVERCLOCK[$i]=$(( _MEMORY_OVERCLOCK + MEMORY_OVERCLOCK_$i ))
done
elif [[ $OVERCLOCK_MODE == GPU_SPECIFIC ]]
then
for i in $(seq 0 $((GPUS-1)))
do
__CORE_OVERCLOCK[$i]=$((__CORE_OVERCLOCK_$i))
MEMORY_OVERCLOCK[$i]=$((MEMORY_OVERCLOCK_$i))
done
elif [[ $OVERCLOCK_MODE == ALGO_SPECIFIC_with_GPU_OFFSET ]]
then
for i in $(seq 0 $((GPUS-1)))
do
__CORE_OVERCLOCK[$i]=$(( ${ALGO}_CORE_OVERCLOCK + __CORE_OVERCLOCK_$i ))
MEMORY_OVERCLOCK[$i]=$(( ${ALGO}_MEMORY_OVERCLOCK + MEMORY_OVERCLOCK_$i ))
done
elif [[ $OVERCLOCK_MODE == ALGO_SPECIFIC ]]
then
for i in $(seq 0 $((GPUS-1)))
do
__CORE_OVERCLOCK[$i]=$((${ALGO}_CORE_OVERCLOCK))
MEMORY_OVERCLOCK[$i]=$((${ALGO}_MEMORY_OVERCLOCK))
done
elif [[ $OVERCLOCK_MODE == MANAGED_BY_SWITCHER ]]
then
echo "INFO: An auto-switcher is taking over GPU Core and Memory clocks management."
echo
else
if [[ $OVERCLOCK_MODE != NO ]]
then
echo "WARNING: '$OVERCLOCK_MODE' is not a valid overclock mode, falling back to 'NO'"
fi
for i in $(seq 0 $((GPUS-1)))
do
__CORE_OVERCLOCK[$i]=0
MEMORY_OVERCLOCK[$i]=0
done
fi
if [[ $SLOW_USB_KEY_MODE == YES ]]
then
sleep 6
fi
if [[ $MINER_TEMP_CONTROL == NO ]]
then
if [[ $MANUAL_FAN == YES ]]
then
gpu=0
while (( gpu < GPUS ))
do
NVD_SETTINGS="${NVD_SETTINGS} -a [gpu:$gpu]/GPUFanControlState=1 -a [fan:$gpu]/GPUTargetFanSpeed=${FAN_SPEED}"
gpu=$((gpu+1))
done
else
gpu=0
while (( gpu < GPUS ))
do
NVD_SETTINGS="${NVD_SETTINGS} -a [gpu:$gpu]/GPUFanControlState=0"
gpu=$((gpu+1))
done
fi
fi
gpu=0
while (( gpu < GPUS ))
do
for j in ${GPU_OC_PROFILE}
do
CORE=${__CORE_OVERCLOCK[${gpu}]}
MEM=${MEMORY_OVERCLOCK[${gpu}]}
NVD_SETTINGS="${NVD_SETTINGS} -a [gpu:$gpu]/GPUGraphicsClockOffset[${j}]=$CORE -a [gpu:$gpu]/GPUMemoryTransferRateOffset[${j}]=$MEM"
done
gpu=$((gpu+1))
done
if [[ $GPUPowerMizerMode_Adjust == YES ]]
then
gpu=0