123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- #!/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
|