Skip to content

Instantly share code, notes, and snippets.

@dolpen
Last active December 19, 2017 09:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dolpen/f04a9810c36b8c4909c14112ccff1be9 to your computer and use it in GitHub Desktop.
Save dolpen/f04a9810c36b8c4909c14112ccff1be9 to your computer and use it in GitHub Desktop.
#!/bin/bash
# do as root
yum -y groupinstall "Development Tools"
yum -y install epel-release git screen
sed -i 's/enabled=1/enabled=0/' /etc/yum.repos.d/epel.repo
yum -y install jansson-devel libcurl-devel
cd /opt
git clone https://github.com/bitzeny/cpuminer.git
cd cpuminer
sh ./autogen.sh
sh ./configure CFLAGS="-O3 -march=native -funroll-loops -fomit-frame-pointer"
make
#!/bin/bash
# num of core
LIMIT=1
MINER_PATH="/opt/cpuminer"
MINER_PROC="minerd"
# please rewrite
POOL_STARTUM="stratum+tcp://stratum.misosi.ru:16002"
POOL_USER="dolpen"
POOL_WORKER="dummy"
POOL_PASSWORD="dummy"
if [ "$POOL_USER" = "" ]; then
echo "check POOL_USER variable";
exit 1
fi
if [ "$POOL_WORKER" = "" ]; then
echo "check POOL_WORKER variable";
exit 1
fi
if [ "$POOL_PASSWORD" = "" ]; then
echo "check POOL_PASSWORD variable";
exit 1
fi
MINER_PARAMS="-a yescrypt -t $LIMIT -o $POOL_STARTUM -u $POOL_USER.$POOL_WORKER -p $POOL_PASSWORD"
MINER_INVOCATION="$MINER_PATH/$MINER_PROC $MINER_PARAMS"
echo "find old processes..."
for i in `ps aux | grep $MINER_PROC | grep -v grep | grep -v SCREEN | gawk '{print $2}'`
do
TIME=`ps -o lstart --noheader -p $i`;
START=`date +%s -d "$TIME"`;
NOW=`date +%s`;
PASSTIME=`expr $NOW - $START`;
if [ $PASSTIME -gt 86400 ]; then
kill $i;
echo "kill $i at "`date`;
fi
done
echo "checking process..."
count=`ps aux | grep $MINER_PROC | grep -v grep | grep -v SCREEN | wc -l`
if [ $count = 0 ]; then
echo "starting new process..."
echo "$MINER_INVOCATION"
screen -AmdS miner $MINER_INVOCATION
echo "started."
else
echo "found running process."
fi
@dolpen
Copy link
Author

dolpen commented Dec 13, 2017

そのまま使うと俺が侵入出来ちゃうので注意 さすがに邪悪すぎるのでユーザー作って鍵突っ込む部分とかは分離した
sedなり何なり使ってアレしてください

wget -q https://gist.githubusercontent.com/dolpen/f04a9810c36b8c4909c14112ccff1be9/raw/a54703ad58678d43f548eb7dbc3af83b7b4ae940/install_bitzeny_miner.sh -O - | sh
wget https://gist.githubusercontent.com/dolpen/f04a9810c36b8c4909c14112ccff1be9/raw/a54703ad58678d43f548eb7dbc3af83b7b4ae940/invoke.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment