Last active
December 19, 2017 09:28
-
-
Save dolpen/f04a9810c36b8c4909c14112ccff1be9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
そのまま使うと俺が侵入出来ちゃうので注意さすがに邪悪すぎるのでユーザー作って鍵突っ込む部分とかは分離したsedなり何なり使ってアレしてください