#!/bin/bash ################################################################################ # # # nvOC # # # # Purpose: Handles a variety of tasks for the nvOC mining operating system # # including stop and start mining, patching, etc # # # # Usage: See echo_usage (below) # # # # # ################################################################################ # # Dev Mod Log: # # v=0001 : Stubo: # Initial Revision # # v=0002 : papampi # changes to clearlogs and stop # # v=0003 : Stubo # removed help # removed > /dev/null 2>&1 from 5watchdog line in stop # # v=0004 : leenoox # added gpumap # added report # added Text output beautifier # applied "bleed" fix # added version, export DISPLAY, source 1bash, added PNY and PALIT PCI ID's # # v=0005 : papampi # added miner-log, wdog-log, temp-log, wtm-log, master-log # # v=0006 : Stubo # changed calls of other external functions to internal subroutine calls # papampi # added wtm_auto_switch version # # v=0007 : papampi # Changed ~/1bash to /home/m1/1bash for known reasons ... # # v=0008 : LukePicci # Relocate nvOC to arbitrary install directory # # v=0009 : LuKePicci # added main-log, install- start- and stop-service # v=0010 : papampi # Detailed OC,PL report, some more fixes for 19-2.1 # v=0011 : LuKePicci # Git repo and submodules status report # v=0012 : LuKePicci # cuda version, service status, upgrade cmdlets export DISPLAY=:0 export NVOC="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" source ${NVOC}/1bash source ${NVOC}/helpers/coin_algo_mapping nvOC_nvOC_Dev="0012" nvOC_nvOC_ver="$nvOC_Ver.$nvOC_nvOC_Dev" # Do not edit this # Text output beautifier, use bold text and colors USE_COLOR="YES" # YES/NO if [[ $USE_COLOR == YES ]] then N='\e[0m' # Normal B='\e[1m' # Bold R='\e[31m' # Red G='\e[32m' # Green C='\e[36m' # Cyan Y='\e[33m' # Yellow else unset N B R G C Y fi ################################################################################ # Subroutines ################################################################################ ############################ Display Help on Usage ############################# echo_usage() { echo "" echo -e "${B}Usage:${N} ${C}$0 clearlogs${N}" echo " clears out OS & nvOC logs" echo -e " ${C}$0 gpuinfo${N}" echo " displays GPU ID, infomation, settings, and status" echo -e " ${C}$0 gpumap${N}" echo " physically map (locate) your GPU's" echo -e " ${C}$0 report${N}" echo " create report about hardware and nvOC relevant settings" echo -e " ${C}$0 restore${N}" echo " restore nvOC files to their unmodified version" echo -e " ${C}$0 upgrade${N}" echo " upgrade to latest nvOC revision for your current branch" echo -e " ${C}$0 miners-upgrade${N}" echo " upgrade nvOC miners collection with latest changes and intall them" echo -e " ${C}$0 reboot${N}" echo " reboots the host machine" echo -e " ${C}$0 stop${N}" echo " stops mining, watchdog and temperature control" echo -e " ${C}$0 start${N}" echo " starts normal nvOC mining operations" echo -e " ${C}$0 restart${N}" echo " restart nvOC mining operations" echo -e " ${C}$0 install-service${N}" echo " (re)install nvOC service for this nvOC tree" echo -e " ${C}$0 start-service${N}" echo " manually start the nvOC service" echo -e " ${C}$0 stop-service${N}" echo " stop the running nvOC service" echo -e " ${C}$0 main-log${N}" echo " display nvOC startup output (Only for nvOC running as a service)" echo -e " ${C}$0 miner-log${N}" echo " display live miner output" echo -e " ${C}$0 cpuminer-log${N}" echo " display live cpuminer output" echo -e " ${C}$0 wdog-log${N}" echo " display live watchdog output (Only for REMOTE)" echo -e " ${C}$0 temp-log${N}" echo " display live temp control output (Only for REMOTE)" echo -e " ${C}$0 wtm-log${N}" echo " display live wtm auto switch output" echo -e " ${C}$0 master-log${N}" echo " display live miner, watchdog, temp control and wtm auto switch output" echo -e " ${C}$0 restore-xorg${N}" echo " Restore default nvOC xorg.conf" } ################################# Clearlogs ###################################### Clearlogs() { echo -e "${B}Clearing logs...${N}" # Must become root to clear these logs sudo su -c "> /var/log/auth.log" sudo su -c "> /var/log/dpkg.log" sudo su -c "> /var/log/syslog" sudo su -c "> /var/log/Xorg.0.log" sudo su -c "> /var/log/kern.log" echo > ${NVOC}/5_watchdoglog echo > ${NVOC}/6_autotemplog echo > ${NVOC}/current-profit echo > ${NVOC}/algo-log rm -r ${NVOC}/kk003_telegram_data > /dev/null 2>&1 echo; echo "...done." } ################################# GPU Info ###################################### GPUinfo() { # Get device IDs DEVICE_IDS=$(nvidia-smi --query-gpu=pci.sub_device_id --format=csv,noheader,nounits) i=0 echo "" INFO+="${B}ID,|,PS,|,T°,|,FAN,|,LOAD,|,POWER / LIMIT / MAX,|,GPUCLOCK,|,MEMCLOCK,|,VENDOR - MODEL\n" for ID in $DEVICE_IDS do # Get vendor id substring VENDOR_ID=${ID:6:5} # GPU Query, 3842=EVGA, 1462=MSI, 10DE=Nvidia, 19DA=Zotac, 807D=Asus, 1458=Gigabyte case $VENDOR_ID in 3842) VENDOR_ID="EVGA";; 1462) VENDOR_ID="MSI";; 10DE) VENDOR_ID="NVIDIA";; 19DA) VENDOR_ID="ZOTAC";; 807D|1043) VENDOR_ID="ASUS";; 1458) VENDOR_ID="GIGABYTE";; 196E) VENDOR_ID="PNY";; 1569) VENDOR_ID="PALIT";; esac # Get most GPU info here { IFS=', ' read PSTATE CURRENT_TEMP CURRENT_FAN UTILIZATION PWRLIMIT POWERDRAW; } < <(nvidia-smi -i $i --query-gpu=pstate,temperature.gpu,fan.speed,utilization.gpu,power.limit,power.draw --format=csv,noheader,nounits) # Some GPU info requires special tactics MODEL=$(nvidia-smi -i $i --query-gpu=name --format=csv,noheader,nounits | tail -1) POWERMAX=$(nvidia-smi -i $i -q|grep "Max Power"|cut -f 2 -d ":"|cut -f 2 -d " ") GPUCLOCK=$(nvidia-smi -i $i -q -d CLOCK |grep Graphics |head -1|cut -f 2 -d ":"|cut -f 2 -d " ") MEMCLOCK=$(nvidia-smi -i $i -q -d CLOCK |grep Memory |head -1|cut -f 2 -d ":"|cut -f 2 -d " ") # convert power values to integer POWERDRAW=$(echo "$POWERDRAW/1" | bc) PWRLIMIT=$(echo "$PWRLIMIT/1" | bc) POWERMAX=$(echo "$PWRLIMIT/1" | bc) # Memory clock display on Nvidia X Server Settings is doubled # uncomment this line if you want it displayed that way # MEMCLOCK=$(($MEMCLOCK * 2)) INFO+="$N$i,|,$PSTATE,|,$CURRENT_TEMP,|,$CURRENT_FAN,|,$UTILIZATION,|,$POWERDRAW / $PWRLIMIT / $POWERMAX,|,$GPUCLOCK,|,$MEMCLOCK,|,$VENDOR_ID - $MODEL\n" (( i++ )) done echo -e $INFO | column -t -s, } ############################### Reboot host ################################### Reboot() { # Reboots the host echo -e "${B}${R}Warning: The host will reboot in 10 seconds, ctrl-c to cancel...${N}" sleep 10 sudo su -c "shutdown -r now" } ############################### Start nvOC in gnome-terminal ################## StartGnomeTerminal() { if [[ $LOCALorREMOTE == REMOTE ]] then export DISPLAY=:0 fi if ps ax | grep -q "[g]nome-terminal" then echo "nvOC already running, use ./nvOC restart" else echo -e "${B}Restarting nvOC tasks....${N}"; echo gnome-terminal --window-with-profile=mining fi } ############################### Stop nvOC in gnome-terminal ################### StopGnomeTerminal() { echo -e "${B}Stopping nvOC processes...${N}"; echo # Kill off the nv_OC processes pkill -ef gnome-terminal pkill -ef 5watchdog pkill -ef 7telegram pkill -ef 6tempcontrol pkill -ef 8wtm pkill -ef screenrc echo; echo "...done." } ############################### Restart Miner ################################## Restart() { # Restart nvOC from scratch if systemctl is-enabled nvoc.service then # nvOC as systemd service StopService && StartService else # nvOC in gnome-terminal StopGnomeTerminal && StartGnomeTerminal fi } ############################### gpumap ######################################## GPUmap() { # gpumap for nvOC v0019-2.0 by leenoox # # Ever wondered which physical video card is assigned as GPU2 or GPU6? # Troubleshooting nightmares? Your watchdog reported that GPU7 failed # of the bus. How do you know which physical card is assigned as GPU7? # # Here is an ingenious way to determine physical location of the GPU's. # # When executed, first, it will stop all mining processes and turn all # GPU fans OFF (and turn GPU Logo LED lights OFF if supported by your GPU's). # # Then it will turn only GPU0 fan ON (and light if supported) allowing you # to physically map which one is GPU0 by simply looking at which fan is spinning. # By pressing "y" button, it will turn GPU0 OFF and move on to the next GPU. # It will turn GPU fans ON then OFF, one by one until the last GPU is reached. # # When finished, it will resume your mining process. # # Please note, due to driver limitation, LED lights can not be controlled # on each and every available model. Do not report this as bug ;) nvOC_gpumap_ver="v0019-2.0.002" # Do not edit this NVD=nvidia-settings # Check if CUDA_DEVICE_ORDER=PCI_BUS_ID is set CUDA_ORDER="/etc/profile.d/cuda-device-order.sh" if [[ -e "$CUDA_ORDER" ]] then if (( $(wc -l <$CUDA_ORDER) > 1 )) then echo echo "Fixing the CUDA_DEVICE_ORDER=PCI_BUS_ID" sudo rm $CUDA_ORDER sudo echo 'export CUDA_DEVICE_ORDER=PCI_BUS_ID' | sudo tee -a /etc/profile.d/cuda-device-order.sh fi else echo "Setting the 'export CUDA_DEVICE_ORDER=PCI_BUS_ID'" echo "in order to properly map GPU's" echo "Please reboot for the changes to take effect" sudo echo 'export CUDA_DEVICE_ORDER=PCI_BUS_ID' | sudo tee -a /etc/profile.d/cuda-device-order.sh echo exit fi # Determine the number of available GPU's GPUS=$(nvidia-smi -i 0 --query-gpu=count --format=csv,noheader,nounits) count=0 # Display version info echo; echo for i in {16..21} do echo -en "\e[48;5;${i}m " done echo -en "${B}gpumap $nvOC_gpumap_ver by leenoox${N}" for i in {21..16} do echo -en "\e[48;5;${i}m \e[0m" done echo; echo; echo sleep 0.5 echo -e "${B}gpumap${N} will help you physically map your GPU's by spinning single" echo -e "GPU fan(s) only, one at a time and turning LED lights ON (if supported)." echo -e "It will also show some info about the GPU. Please follow prompts." echo; echo echo -e "${B}gpumap${N} has detected: ${B}$GPUS${N} GPU's" echo; echo echo -e "${Y}To continue we have to temporary stop all mining processes." echo -e "Once finished, mining processes will resume.${N}${B}" echo read -r -n 1 -p "Continue (y/n)? " response echo -e "${N}"; echo if [[ $response =~ ^[Yy]$ ]] then echo -e "${Y}Stopping nvOC processes...${N}" # Kill off the nv_OC processes Stop echo echo "... done!" echo; echo echo -e "${Y}Turning all fans and LED lights OFF...${N}" echo # Turn everything OFF while (( count < GPUS )) do ${NVD} -a [gpu:${count}]/GPUFanControlState=1 >/dev/null 2>&1 ${NVD} -a [fan:${count}]/GPUTargetFanSpeed=0 >/dev/null 2>&1 ${NVD} -a [gpu:${count}]/GPULogoBrightness=0 >/dev/null 2>&1 (( count++ )) done echo "... done!" echo; echo count=0 # Turn fan/LED ON - one GPU at a time while (( count < GPUS )) do ${NVD} -a [fan:${count}]/GPUTargetFanSpeed=75 >/dev/null 2>&1 ${NVD} -a [gpu:${count}]/GPULogoBrightness=100 >/dev/null 2>&1 echo -e "${Y}Take a look at your rig for spinning fan now${N}" echo echo -e "${B}GPU$count${N} fan and LED are ON. This is your ${B}GPU$count${N}." echo # Stubo's Vendor detection ID=$(nvidia-smi -i $count --query-gpu=pci.sub_device_id --format=csv,noheader,nounits) VENDOR_ID=${ID:6:4} case $VENDOR_ID in 3842) VENDOR_ID="EVGA";; 1462) VENDOR_ID="MSI";; 10DE) VENDOR_ID="NVIDIA";; 19DA) VENDOR_ID="ZOTAC";; 807D|1043) VENDOR_ID="ASUS";; 1458) VENDOR_ID="GIGABYTE";; 196E) VENDOR_ID="PNY";; 1569) VENDOR_ID="PALIT";; esac MODEL=$(nvidia-smi -i $count --query-gpu=name --format=csv,noheader,nounits | tail -1) POWERMAX=$(nvidia-smi -i $count -q|grep "Max Power"|cut -f 2 -d ":"|cut -f 2 -d " ") POWERMIN=$(nvidia-smi -i $count -q|grep "Min Power"|cut -f 2 -d ":"|cut -f 2 -d " ") SLOWDOWN=$(nvidia-smi -i $count -q|grep "Slowdown Temp"|cut -f 2 -d ":"|cut -f 2 -d " ") SHUTDOWN=$(nvidia-smi -i $count -q|grep "Shutdown Temp"|cut -f 2 -d ":"|cut -f 2 -d " ") BUSID=$(nvidia-smi -i $count -q|grep "Bus Id"|cut -f 2- -d ":"|cut -f 2- -d " ") echo -e "${B}GPU$count info:${N}" echo "$VENDOR_ID $MODEL" echo "Bus ID: $BUSID" echo "Min Power Limit: $POWERMIN" echo "Max Power Limit: $POWERMAX" echo "GPU Slowdown Temp: $SLOWDOWN" echo "GPU Shutdown Temp: $SHUTDOWN" echo echo # Move on to the next GPU echo -e "${B}" read -r -n 1 -p "Continue (y/n)? " response echo -e "${N}"; echo if [[ $response =~ ^[Yy]$ ]] then ${NVD} -a [fan:${count}]/GPUTargetFanSpeed=0 >/dev/null 2>&1 ${NVD} -a [gpu:${count}]/GPULogoBrightness=0 >/dev/null 2>&1 elif [[ $response =~ ^[Nn]$ ]] then ${NVD} -a [fan:${count}]/GPUTargetFanSpeed=0 >/dev/null 2>&1 ${NVD} -a [gpu:${count}]/GPULogoBrightness=0 >/dev/null 2>&1 echo -e "Acknowledged. Thank you for using ${B}gpumap${N}" echo "Resuming mining operation now..." echo "" Restart else echo "Neither y or n were pressed!" echo "Lets try this again..." read -r -n 1 -p "Continue (y/n)? " response echo -e "${N}"; echo "" if [[ $response =~ ^[Yy]$ ]] then ${NVD} -a [fan:${count}]/GPUTargetFanSpeed=0 >/dev/null 2>&1 ${NVD} -a [gpu:${count}]/GPULogoBrightness=0 >/dev/null 2>&1 else echo "Neither y or n were pressed again!" ${NVD} -a [fan:${count}]/GPUTargetFanSpeed=0 >/dev/null 2>&1 ${NVD} -a [gpu:${count}]/GPULogoBrightness=0 >/dev/null 2>&1 echo -e "Thank you for using ${B}gpumap${N}" echo "Resuming mining operation now." Restart fi fi echo; echo (( count++ )) done else exit fi echo -e "${Y}All done, that was the last detected GPU.${N}" echo; echo echo -e "Thank you for using ${B}gpumap${N}" echo read -r -p "Resume mining operation now? (y/n + enter): " response echo -e "${N}"; echo "" if [[ $response =~ ^[Yy]$ ]] then Restart fi } ############################### report ######################################## Report() { # DEV_VERSION=002 # Last edit by: leenoox # Status: incomplete # Report generator for nvOC v0019-2.0 - Community Release # Report generator by leenoox # # The Report function gathers hardware and software information, system settings, # as well as the relevant settings info from the nvOC settings file, 1bash. # It gives an overview of the most important aspects of your rig. # # The generated Report can be copied and posted on the official nvOC bitcointalk.org # forum and will help with the request for troubleshooting, or simply post a standard # generated Report when one is needed. # # To generate the report simply run: # ./nvOC report # # then copy everything including the [code] and [/code] tags and post on bitcointalk.org # This comment section to be removed in the final script # Tested on: # (8 core) - Core(TM) i7-7700 CPU @ 3.60GHz # (4 core) - Core(TM) i5-3570 CPU @ 3.40GHz # (2 core) - Celeron(R) CPU G3930 @ 2.90GHz # MB: ASRock H110 Pro BTC+ # MB: ASUS PRIME Z270-A Rev 1.xx # MB: ASUS P8Z77-V LK Rev X.0x # # TODO # * Check if internet connection is up # * Check if CUDA_DEVICE_ORDER is set # * finish collection of data from whole 1bash (currently about 80%) # * add alias to .bashrc # * function to clean/replace any string matching the array, eg. AsusTek to Asus. Intel Corp. to Intel # * way to determine exact number of cores and threads, right now cores+threads are # reported together as a single number # * Works well on older version, not fully compatible with 19-2, need to change few queries, eg. nvOC version, # change new naming scheme for watchdog, temp control... REPORT_VER="$nvOC_nvOC_ver" clear # Display version info echo for i in {16..21} do echo -en "\e[48;5;${i}m " done echo -en "${B}Report generator for nvOC $nvOC_Ver v$nvOC_nvOC_Dev ${N}" for i in {21..16} do echo -en "\e[48;5;${i}m \e[0m" done echo echo # Collect info and ssign to variables ####################################### nvidia_driver_ver=$(nvidia-smi -i 0 -q|grep "Driver Version"|cut -f 2 -d ":"|cut -f 2 -d " ") nvOC_ver_from_1bash=$(cat ${NVOC}/1bash | grep nvOC_Ver| sed 's/^.*="v//' | sed 's/\"//'); nvOC_1bash_temp_ver=$(cat ${NVOC}/1bash.template | grep nvOC_1bash_ver= | sed 's/nvOC_1bash_ver=//' | sed 's/\"//' | sed 's/\"//' ) nvOC_3main_ver=$(head -n 100 ${NVOC}/3main | grep nvOC_3main_Dev= | sed 's/nvOC_3main_Dev=//' | sed 's/\"//' | sed 's/\"//' ) nvOC_wdog_ver=$(head -n 100 ${NVOC}/5watchdog | grep nvOC_wdog_Dev= | sed 's/nvOC_wdog_Dev=//' | sed 's/\"//' | sed 's/\"//') nvOC_temp_ver=$(head -n 100 ${NVOC}/6tempcontrol | grep nvOC_temp_Dev= | sed 's/nvOC_temp_Dev=//' | sed 's/\"//' | sed 's/\"//' ) nvOC_wtm_ver=$( head -n 100 ${NVOC}/8wtm_auto_switch | grep wtm_auto_switch_Dev= | sed 's/wtm_auto_switch_Dev=//' | sed 's/\"//' | sed 's/\"//') nvOC_wtm_p_ver=$( head -n 100 ${NVOC}/8wtm_profit_check | grep wtm_profit_check_Dev= | sed 's/wtm_profit_check_Dev=//' | sed 's/\"//' | sed 's/\"//') nvOC_pools_switch_ver=$( head -n 100 ${NVOC}/9poolswitch | grep nvOC_poolswitch_Dev= | sed 's/nvOC_poolswitch_Dev=//' | sed 's/\"//' | sed 's/\"//') nvOC_minerinfo_ver=$( head -n 100 ${NVOC}/www/cgi-bin/minerinfo | grep nvOC_minerinfo_Dev= | sed 's/nvOC_minerinfo_Dev=//' | sed 's/\"//' | sed 's/\"//') kernel=$(cat /proc/version | cut -d' ' -f 3); # os_release=$(cat /usr/lib/os-release | grep PRETTY_NAME | sed 's/PRETTY_NAME=\"//' | sed 's/\"//'); # os_release=$(cat /etc/lsb-release | grep DISTRIB_DESCRIPTION | sed 's/DISTRIB_DESCRIPTION=\"//' | sed 's/\"//'); os_release=$(cat /etc/issue.net) system=$(cat /proc/version | cut -d' ' -f 5,7,9,10); mbvendor=$(cat /sys/devices/virtual/dmi/id/board_vendor); mbmodel=$(cat /sys/devices/virtual/dmi/id/board_name); mbversion=$(cat /sys/devices/virtual/dmi/id/board_version); biosver=$(cat /sys/devices/virtual/dmi/id/bios_version); biosdate=$(cat /sys/devices/virtual/dmi/id/bios_date); cpu=$(cat /proc/cpuinfo | grep -m 1 "model name" | cut -d' ' -f 4-); cores=$(cat /proc/cpuinfo | grep "model name" | wc -l); memtotal=$(cat /proc/meminfo | grep MemTotal | cut -d' ' -f 2-); memfree=$(cat /proc/meminfo | grep MemFree | cut -d' ' -f 2-); swaptotal=$(cat /proc/meminfo | grep SwapTotal | cut -d' ' -f 2-); swapfree=$(cat /proc/meminfo | grep SwapFree | cut -d' ' -f 2-); ethernet=$(lspci | grep Ethernet | cut -d' ' -f 4-); # Replace strings for better output: # (Motherboard) replace: "ASUSTeK COMPUTER INC." with "ASUS" # (Ethernet) replace: "Realtek Semiconductor Co., Ltd." with "Realtek" # (Ethernet) replace: "Intel Corporation Ethernet Connection (2)" with "Intel" # if echo "$mbvendor" | grep -q "ASUSTeK" ; then mbvendor="ASUS"; fi if [[ $mbvendor == ASUSTeK* ]] then mbvendor="ASUS" fi if echo "$ethernet" | grep -q "Realtek" then ethernet=$( echo $ethernet | sed 's/Realtek Semiconductor Co., Ltd./Realtek/g' ) elif echo "$ethernet" | grep -q "Intel" then ethernet=$( echo $ethernet | sed 's/Intel Corporation Ethernet Connection (2)/Intel/g' ) fi ####################################### # Output on screen ####################################### echo echo "[code]" echo -e \ " ${B}Operating System info:${N} Kernel : $kernel OS : $os_release System : $system nvidia driver : $nvidia_driver_ver ${B}nvOC info:${N} nvOC path : ${NVOC} nvOC : $nvOC_ver_from_1bash Report : $nvOC_nvOC_Dev 1bash : $nvOC_1bash_ver 1bash.template: $nvOC_1bash_temp_ver 3main : $nvOC_3main_ver 5watchdog : $nvOC_wdog_ver 6tempcontrol : $nvOC_temp_ver wtm switch : $nvOC_wtm_ver wtm profit : $nvOC_wtm_p_ver pool switch : $nvOC_pools_switch_ver minerinfo : $nvOC_minerinfo_ver ${B}Hardware info:${N} Motherboard : $mbvendor $mbmodel $mbversion BIOS ver. : $biosver $biosdate CPU Model : $cpu CPU Cores : $cores (Cores + Threads) Mem Total : $memtotal Mem Free : $memfree Swap Total : $swaptotal Swap Free : $swapfree Ethernet : $ethernet" echo # CUDA ####################################### echo -e "${B}CUDA SDK version${N}" echo "nvcc path : $(which nvcc)" nvcc --version echo # nvoc.service ####################################### if [[ -e /etc/systemd/system/nvoc.service ]] then echo -e "${B}nvoc.service systemd's log${N}" service nvoc status | cat else echo "nvOC is not installed as a service" fi echo # HDD ####################################### echo -e "${B}HDD and Partion info:${N}" # df -H # sudo fdisk -l -L=never | grep dev lsblk -o name,size,fstype,type,rota,hotplug,tran,vendor,model,rev,mountpoint echo # VGA ####################################### echo -e "${B}VGA info:${N}" lspci | grep VGA echo # Git ####################################### echo -e "${B}Local git branch and submodules status:${N}" git -C ${NVOC} status -s -b -uno --ignore-submodules=all git -C ${NVOC} submodule status git -C ${NVOC}/miners status -s -b -uno --ignore-submodules=all git -C ${NVOC}/miners submodule status echo # 1bash settings ####################################### echo -e "${B}1bash settings:${N}" # 1bash general echo "1bash version .............: $nvOC_1bash_ver" # for pre 19.2 versions use $(cat ${NVOC}/1bash | grep "nvOC v" | cut -d' ' -f 2-) echo "LOCAL or REMOTE ...........: $LOCALorREMOTE" echo "TEAMVIEWER started ........: $TEAMVIEWER" echo "SSH daemon started ........: $SSH" echo "SLOW_USB_KEY_MODE .........: $SLOW_USB_KEY_MODE" echo "SRR .......................: $SRR" echo echo "Watchdog ..................: $MINER_WATCHDOG" echo "SYSRQ Reboot ..............: $SYSRQ_REBOOT" echo "Watchdog Cycle ............: $WATCHDOG_CYCLE" echo "GPU Utilization Threshold .: $GPU_UTIL_THRESHOLD" echo "Alternate Pool ............: $ALT_POOL" echo # Temp control echo "Temp Control ..............: $MINER_TEMP_CONTROL" echo "MANUAL_FAN ................: $MANUAL_FAN" if [[ $MANUAL_FAN == YES ]] then echo "MANUAL FAN_SPEED ..........: $FAN_SPEED" fi if [[ $MINER_TEMP_CONTROL == YES ]] then echo "TARGET_TEMP ...............: $TARGET_TEMP" echo "__FAN_ADJUST ..............: $__FAN_ADJUST" echo "POWER_ADJUST ..............: $POWER_ADJUST" echo "ALLOWED_TEMP_DIFF .........: $ALLOWED_TEMP_DIFF" echo "RESTORE_POWER_LIMIT .......: $RESTORE_POWER_LIMIT" echo "MINIMAL_FAN_SPEED .........: $MINIMAL_FAN_SPEED" echo "MAXIMAL_FAN_SPEED .........: $MAXIMAL_FAN_SPEED" fi echo # 1bash maintenance echo "CLEAR_LOGS_ON_BOOT ........: $CLEAR_LOGS_ON_BOOT" echo "AUTO_REBOOT ...............: $AUTO_REBOOT" if [[ $AUTO_REBOOT == YES ]] then echo "REBOOT_TIMEOUT_IN_MINUTES .: $REBOOT_TIMEOUT_IN_MINUTES" fi echo "_Parallax_MODE (upPaste)...: $_Parallax_MODE" if [[ $_Parallax_MODE == YES ]] then echo "pasteBASH .................: $pasteBASH" echo "upPASTE_TIMEOUT_IN_MINUTES.: $upPASTE_TIMEOUT_IN_MINUTES" fi echo # 1bash telegram echo "TELEGRAM_MESSAGES .: $TELEGRAM_MESSAGES" echo "TELEGRAM_ALERTS ...: $TELEGRAM_ALERTS" if [[ $TELEGRAM_MESSAGES == YES || $TELEGRAM_ALERTS == YES ]] then echo "TELEGRAM_TYPE .............: $TELEGRAM_TYPE" echo "TELEGRAM_TIMEOUT_IN_MINUTES: $TELEGRAM_TIMEOUT_IN_MINUTES" echo "TELEGRAM_CHATID ...........: CHATID_NOT_SHOWN" echo "TELEGRAM_APIKEY ...........: APIKEY_NOT_SHOWN" fi echo echo "HEADLESS MODE:.............: $HEADLESS_MODE" echo "GPUPowerMizerMode_Adjust...: $GPUPowerMizerMode_Adjust" if [[ $GPUPowerMizerMode_Adjust == YES ]] then echo "GPUPowerMizerMode .........: $GPUPowerMizerMode" fi echo "ETH Pill ..................: $OhGodAnETHlargementPill" echo GPUS=$(nvidia-smi -i 0 --query-gpu=count --format=csv,noheader,nounits) # 1bash OC echo "POWERLIMIT MODE ...........: $POWERLIMIT_MODE" if [[ $POWERLIMIT_MODE == GLOBAL ]] then echo "Power Limit WATTS .........: $_POWERLIMIT_WATTS" elif [[ $POWERLIMIT_MODE == ALGO_SPECIFIC ]] then eval 'ALGO_PL=${ALGO}_POWERLIMIT_WATTS' echo "Power Limit WATTS .........: ${!ALGO_PL}" elif [[ $POWERLIMIT_MODE == GPU_SPECIFIC ]] then for i in $(seq 0 $((GPUS-1))) do echo "GPU$i Power Limit ..........: $((INDIVIDUAL_POWERLIMIT_$i))" done elif [[ $POWERLIMIT_MODE == GLOBAL_with_GPU_OFFSET ]] then for i in $(seq 0 $((GPUS-1))) do echo "GPU$i Power Limit ..........: $(( _POWERLIMIT_WATTS + INDIVIDUAL_POWERLIMIT_$i ))" done elif [[ $POWERLIMIT_MODE == ALGO_SPECIFIC_with_GPU_OFFSET ]] then for i in $(seq 0 $((GPUS-1))) do echo "GPU$i Power Limit ..........: $(( ${ALGO}_POWERLIMIT_WATTS + INDIVIDUAL_POWERLIMIT_$i ))" done fi echo "OVERCLOCK MODE ............: $OVERCLOCK_MODE" if [[ $OVERCLOCK_MODE == GLOBAL ]] then echo "Memory Overclock ..........: $_MEMORY_OVERCLOCK" echo "Core Overclock ............: $_CORE_OVERCLOCK" elif [[ $OVERCLOCK_MODE == ALGO_SPECIFIC ]] then eval 'ALGO_OC=${ALGO}_CORE_OVERCLOCK' eval 'ALGO_MC=${ALGO}_MEMORY_OVERCLOCK' echo "Core Overclock ............: ${!ALGO_OC}" echo "Memory Overclock ..........: ${!ALGO_MC}" elif [[ $OVERCLOCK_MODE == GPU_SPECIFIC ]] then for i in $(seq 0 $((GPUS-1))) do echo "GPU$i Core Overclock ........: $((__CORE_OVERCLOCK_$i))" echo "GPU$i Memory Overclock ......: $((MEMORY_OVERCLOCK_$i))" done elif [[ $OVERCLOCK_MODE == GLOBAL_with_GPU_OFFSET ]] then for i in $(seq 0 $((GPUS-1))) do echo "GPU$i Core Overclock ........: $(( _CORE_OVERCLOCK + __CORE_OVERCLOCK_$i )) " echo "GPU$i Memory Overclock ......: $(( _MEMORY_OVERCLOCK + MEMORY_OVERCLOCK_$i ))" done elif [[ $OVERCLOCK_MODE == ALGO_SPECIFIC_with_GPU_OFFSET ]] then for i in $(seq 0 $((GPUS-1))) do echo "GPU$i Core Overclock ........: $(( ${ALGO}_CORE_OVERCLOCK + __CORE_OVERCLOCK_$i ))" echo "GPU$i Memory Overclock ......: $(( ${ALGO}_MEMORY_OVERCLOCK + MEMORY_OVERCLOCK_$i ))" done fi echo # 1bash mining echo "GLOBAL WORKERNAME .........: $GLOBAL_WORKERNAME" echo "AUTO WORKERNAME ...........: $AUTO_WORKERNAME" if [[ $AUTO_WORKERNAME == CUSTOM || $AUTO_WORKERNAME == HOST ]] then echo "WORKERNAME ................: $WORKERNAME" elif [[ $AUTO_WORKERNAME == MAC ]] then WORKERNAME=$(echo $MAC_AS_WORKER | cut -d'_' -f 5-) echo "WORKERNAME ................: hidden_$WORKERNAME" fi echo "plusCPU ...................: $plusCPU" if [[ $plusCPU == YES ]] then echo "threadCOUNT ...............: $threadCOUNT" fi echo # 1bash auto switching echo "AUTO_SWITCH ...............: $AUTO_SWITCH" if [[ $AUTO_SWITCH == WTM_SWITCHING ]] then echo "WTM_AUTO_SWITCH_COINS .....: $WTM_AUTO_SWITCH_COINS" echo "WTM_AUTO_SWITCH_URL .......: ${WTM_AUTO_SWITCH_URL:0:49}" fi # 1bash coin, miner, pool, port, address echo "COIN ......................: $COIN" echo "ALGO ......................: $ALGO" MINER=${ALGO}_MINER echo "MINER .....................: ${!MINER}" if [[ ${COIN:0:5} == ZPOOL ]] then echo "ZPOOLPASS .................: hidden_pass...,"$(echo $ZPOOLPASS | cut -d',' -f 2-) fi COIN_WORKER_TMP=${COIN}_WORKER echo $COIN "WORKER ................:" ${!COIN_WORKER_TMP} COIN_ADDRESS_TMP=${COIN}_ADDRESS echo $COIN "ADDRESS ...............:" ${!COIN_ADDRESS_TMP::8}... COIN_POOL_TMP=${COIN}_POOL echo $COIN "POOL ..................:" ${!COIN_POOL_TMP} COIN_PORT_TMP=${COIN}_PORT if [[ ${!COIN_PORT_TMP} != "" ]] then echo $COIN "PORT ..................:" ${!COIN_PORT_TMP} fi ALGO_INTENSITY_TMP=${ALGO}_INTENSITY if [[ ${!ALGO_INTENSITY_TMP} != "" ]] then echo $ALGO "INTENSITY ..........:" ${!ALGO_INTENSITY_TMP} fi echo echo "[/code]" echo echo echo "WORK IN PROGRESS! Report script (beta release)" echo echo "*** If posting the Report on bitcointalk.org forum please copy everything" echo " between the [code] and [/code] including the [code] and [/code] tags." echo " This will ensure proper alignment when posting the Report." echo echo } ################################# Pull nvOC commits ############################## Upgrade() { echo -e "${Y}Warnings${N}: - your customized 1bash settings won't be affected, but you may have to create a new one starting from a frash copy of ${B}1bash.template${N} if it gets updated during this upgrade, otherwise you will get a warning each time nvOC restarts - the upgrade will fail safely if you made conflicting customizations to any other nvOC script: if it happens you need either to run this script with ${C}restore${N} command or manually manage this by git commands. " read -p "Do you want to continue (y/N)? " -n 1 ans echo if [[ ${ans,,} != y ]] then exit 0 fi echo "Checking for nvOC updates... (target: '${NVOC}')" git -C ${NVOC} pull echo -e "nvOC has been upgraded." # check 1bash revision mismatch source "${NVOC}/1bash" current_1bash_ver="$nvOC_1bash_ver" source "${NVOC}/1bash.template" template_1bash_ver="$nvOC_1bash_ver" last_compatible_1bash_ver="$nvOC_1bash_last_compatible" least_compatible_1bash_ver="$nvOC_1bash_least_compatible" if (( current_1bash_ver < least_compatible_1bash_ver )) then echo -e " $(tput bold)################################################################################" echo "" echo -e "\e[31m Your 1bash revision is not compatible with latest update" echo " Please update your 1bash from 1bash.template before restarting nvOC" echo -e " $(tput sgr0)" echo -e " $(tput bold)################################################################################ $(tput sgr0)" elif (( current_1bash_ver < last_compatible_1bash_ver )) then echo -e " $(tput bold)################################################################################" echo " Your 1bash revision is older than last compatible version" echo " There are new features available if you update your 1bash with latest 1bash.template." echo " Please, update your 1bash to comply with 1bash.template." echo "################################################################################ $(tput sgr0)" fi echo -e "There may be new required miners packages to be installed. Would you like to check for further miners updates and install them now?" read -p "Do you want to continue (Y/n)? " -n 1 ans echo if [[ ${ans,,} != n ]] then MinersUpgrade fi } ################################# Restore working tree ############################## Restore() { echo "Checking for modified contents..." git -C ${NVOC} status -s -uno --ignore-submodules=all echo "Stashing nvOC tree modifications" git -C ${NVOC} stash echo -e "${B}Done.${N} Your modified contents has been restored. You can now ${C}upgrade${N}." echo "If you just made a mistake you can still recover your mods, see '${B}git stash --help${N}'." } ################################# Pull and install miners submodule ############################## MinersUpgrade() { echo "Checking for nvOC miners updates..." git -C ${NVOC} submodule update --init --force --depth 1 --remote miners echo "Running updates installer" pushd . bash ${NVOC}/miners/nvOC_miner_update.sh popd } ################################# install systemd nvoc.service template ############################## InstallService() { echo -e "${Y}Warnings${N}: - if you don't know what means to run nvOC as a system service you probably don't need to run this command, please choose not to continue (press 'n') - by default nvOC runs in gnome-terminal, installing it as a service will switch to systemd instead - the nvoc systemd service manifest has been tested successfully in some environments, but it has to be still considered as beta " read -p "Do you want to continue (y/N)? " -n 1 ans echo if [[ ${ans,,} != y ]] then exit 0 fi echo "Reinstalling nvOC service for ${NVOC}" sudo bash -c 'cat > /etc/systemd/system/nvoc.service' << EOF [Unit] Description=nvOC Service [Service] Type=forking User=$(whoami) Environment=GPU_FORCE_64BIT_PTR=0 Environment=GPU_MAX_HEAP_SIZE=100 Environment=GPU_USE_SYNC_OBJECTS=1 Environment=GPU_MAX_ALLOC_PERCENT=100 Environment=GPU_SINGLE_ALLOC_PERCENT=100 Environment=DISPLAY=:0 Environment=XAUTHORITY=${HOME}/.Xauthority Environment=NVOC=${NVOC} WorkingDirectory=${NVOC} ExecStart=/usr/bin/screen -c ${NVOC}/screenrc-main -dmSL main /bin/bash "${NVOC}/2unix" Restart=always [Install] WantedBy=graphical.target EOF if sudo systemd-analyze verify nvoc.service then #echo -e "Setting ACL for '${B}nvoc${N}' user write access to NVOC path..." #sudo setfacl -m user:nvoc:rw ${NVOC} sudo systemctl enable nvoc echo -e "${B}Done.${N} This service has autostart enabled." else echo "Service installation failed" fi } ################################# start nvoc systemd service ################################ StartService() { echo "Starting nvOC service.." sudo systemctl start nvoc sleep 2 systemctl status nvoc } ################################# stop nvoc systemd service ################################# StopService() { echo "Stopping nvOC service.." sudo systemctl stop nvoc } ################################# main-log ###################################### main-log() { tail -f ${NVOC}/nvoc_logs/main-screenlog.0 } ################################# miner-log ###################################### miner-log() { tail -f ${NVOC}/nvoc_logs/screenlog.0 } ################################# cpuminer-log ################################### cpuminer-log() { tail -f ${NVOC}/nvoc_logs/cpuminer-screenlog.0 } ################################# wdog-log ###################################### wdog-log() { tail -f ${NVOC}/nvoc_logs/watchdog-screenlog.0 } ################################# temp-log ###################################### temp-log() { tail -f ${NVOC}/nvoc_logs/tempcontrol-screenlog.0 } ################################# wtm-log ###################################### wtm-log() { tail -f ${NVOC}/nvoc_logs/8_wtmautoswitchlog } ################################# master-log ###################################### master-log() { tail -f ${NVOC}/nvoc_logs/screenlog.0 ${NVOC}/nvoc_logs/tempcontrol-screenlog.0 ${NVOC}/nvoc_logs/watchdog-screenlog.0 ${NVOC}/nvoc_logs/8_wtmautoswitchlog } ################################# Restore xorg ###################################### restore-xorg() { echo -e "${B}Restoring default nvOC xorg.conf ...${N}" touch "${NVOC}/xorg_flag" echo > "${NVOC}/xorg_flag" sudo wget -N --no-check-certificate https://raw.githubusercontent.com/papampi/nvOC_by_fullzero_Community_Release/19-2.1/xorg.conf.default -O /etc/X11/xorg.conf.default sudo cp /etc/X11/xorg.conf.default /etc/X11/xorg.conf echo "Default xorg.conf restored, Rebooting system in 5 sec." echo "System may reboot again if HEADLESS_MODE=YES"; echo sleep 5 sudo reboot } ############################################################################### ################################# Main Logic ################################## ############################################################################### # This could be annoying: # Clear the screen and simulate the prompt and the command they ran prompt="$USER@$HOSTNAME:~$" clear echo "$prompt$0 $1" # Handle the command line parameters case $# in 0) echo_usage;; 1) case $1 in clearlogs) Clearlogs;; gpuinfo) GPUinfo;; gpumap) GPUmap;; report) Report;; reboot) Reboot;; start) StartGnomeTerminal;; stop) StopGnomeTerminal;; restart) Restart;; restore) Restore;; upgrade) Upgrade;; miners-upgrade) MinersUpgrade;; install-service) InstallService;; start-service) StartService;; stop-service) StopService;; main-log) main-log;; miner-log) miner-log;; cpuminer-log) cpuminer-log;; wdog-log) wdog-log;; temp-log) temp-log;; wtm-log) wtm-log;; master-log) master-log;; restore-xorg) restore-xorg;; *) echo_usage;; esac;; *) echo_usage;; esac