#!/bin/bash FoxyPool_service=Yes FoxyPool_service=${FoxyPool_service^^} if [ -f /tmp/latest ]; then rm /tmp/latest ; fi curl -s https://api.github.com/repos/foxypool/foxy-gh-farmer/releases/latest > /tmp/latest VERSION=$(cat /tmp/latest | grep "tag_name" | awk {'print$2'} | tr -d \",) URL=$(cat /tmp//latest |grep "browser_download_url.*ubuntu.zip" | cut -d : -f 2,3 | tr -d \") if [[ "$FoxyPool_service" == "YES" ]] || [[ "$FoxyPool_service" == "NO" ]];then error_flag=$((error_flag+0));else error_flag=$((error_flag+1));fi function print_centered { [[ $# == 0 ]] && return 1 declare -i TERM_COLS="$(tput cols)" declare -i str_len="${#1}" [[ $str_len -ge $TERM_COLS ]] && { echo "$1"; return 0; } declare -i filler_len="$(( (TERM_COLS - str_len) / 2 ))" [[ $# -ge 2 ]] && ch="${2:0:1}" || ch=" " filler="" for (( i = 0; i < filler_len; i++ )); do filler="${filler}${ch}" done printf "%s%s%s" "$filler" "$1" "$filler" [[ $(( (TERM_COLS - str_len) % 2 )) -ne 0 ]] && printf "%s" "${ch}" printf "\n" return 0 } export TERM=xterm-256color print_centered "$(tput setaf 130)" print_centered " _____ _ " print_centered "| __|___ _ _ _ _ ___ ___ ___| |" print_centered "| __| . |_'_| | | . | . | . | |" print_centered "|__| |___|_,_|_ | _|___|___|_|" print_centered " |___|_| " print_centered "" echo -n "$(tput sgr0)" print_centered "Version $VERSION" if [ $error_flag -ne 0 ] then echo -n "$(tput setaf 1 ;tput bold)" print_centered "Config Error !!!" echo -n "$(tput sgr0)" exit 0 fi case $FoxyPool_service in YES) echo -n "$(tput setaf 44)" print_centered "FoxyPool Service Enabled" echo -n "$(tput sgr0)" ;; esac echo -e "\n" if [ ! -d ~/miners/foxypool ] then mkdir ~/miners/foxypool fi echo -e "$(tput setaf 10)\nInstall Foxy-gh-Farmer:$(tput sgr0)" cd ~/miners/foxypool wget -q $URL unzip -q -o foxy-gh-farmer-ubuntu.zip rm foxy-gh-farmer-ubuntu.zip echo -e "\e[97mDone.\e[0m" function foxypool_service_ { echo -e "$(tput setaf 10)\nInstall FoxyPool service :$(tput sgr0)" cat > $HOME/foxypool.service << EOF [Unit] Description=Foxy-GH-Farmer Service After=network.target Wants=network-online.target [Service] Type=simple User=$USER WorkingDirectory=$HOME/miners/foxypool ExecStart=$HOME/miners/foxypool/foxy-gh-farmer -c $HOME/miners/foxypool/foxy-gh-farmer.yaml Restart=on-failure RestartSec=30 LimitNOFILE=99999 StandardOutput=syslog StandardError=syslog SyslogIdentifier=foxy-gh-farmer [Install] WantedBy=multi-user.target EOF sudo mv $HOME/foxypool.service /etc/systemd/system/foxypool.service >/dev/null sudo chmod 644 /etc/systemd/system/foxypool.service cat <<'EOF'>> foxypool.conf if $programname == 'foxy-gh-farmer' then /var/log/foxypool.log & stop EOF sudo cp foxypool.conf /etc/rsyslog.d/foxypool.conf sudo rm foxypool.conf if [ ! -f /var/log/foxypool.log ] then sudo touch /var/log/foxypool.log sudo chown syslog:adm /var/log/foxypool.log fi cat <<'EOF'>> logrot /var/log/foxypool.log { daily rotate 7 copytruncate notifempty missingok su root syslog } EOF sudo cp logrot /etc/logrotate.d/foxypool sudo rm logrot sudo systemctl restart rsyslog >/dev/null 2>&1 sudo systemctl daemon-reload >/dev/null 2>&1 sudo systemctl enable foxypool >/dev/null 2>&1 sudo systemctl start foxypool >/dev/null 2>&1 echo -e "\e[97mDone.\e[0m\n" } function bashing { cat <<'EOF'>> ~/foxypool.sh #!/bin/bash CTR=xch19fewtlx936jx689nzf0ufngcunwvq7mjcdtncxtdqmh9axtpaelqx0k32s FPK=848417a79e0f94eafd158eac202b42c250caef8a4b262dbb1b5f6f7e347087f0e53e58a2e5585f85f67ac33507677176 OUT=/Partage/Plots/ ./cuda_plot_k32 -S 3 -g 0 -c $CTR -f $FPK -C 17 -n -1 -t /raid/ -3 /raid/ -d $OUT #ProofOfSpace farm -t 8 -d 100 -f /Partage/Plots/*.plot EOF chmod +x ~/foxypool.sh cp ~/foxypool.sh ~/chia/chia-gigahorse/cuda-plotter/linux/x86_64/foxypool.sh rm ~/foxypool.sh } if [ $FoxyPool_service = "YES" ]; then foxypool_service_;fi rm /tmp/latest bashing