Skip to content

Instantly share code, notes, and snippets.

@tiancheng91
Created May 6, 2018 02:42
Show Gist options
  • Save tiancheng91/65a1b0393209b0a89368e55f3a32b3e3 to your computer and use it in GitHub Desktop.
Save tiancheng91/65a1b0393209b0a89368e55f3a32b3e3 to your computer and use it in GitHub Desktop.
挖矿
#! /bin/bash
set -e
hname=`ip -4 route get 114.114.114.114 | awk {'print $7'} | tr -d '\n'`
# set hugepage and memlock
grep -q -F '* soft memlock 262144' /etc/security/limits.conf || echo '* soft memlock 262144' >> /etc/security/limits.conf
grep -q -F '* hard memlock 262144' /etc/security/limits.conf || echo '* hard memlock 262144' >> /etc/security/limits.conf
grep -q -F 'vm.nr_hugepages = 256' /etc/sysctl.conf || echo 'vm.nr_hugepages = 256' >> /etc/sysctl.conf
set +e
sysctl -w vm.nr_hugepages=256
set -e
#apt-get -y install libhwloc4
wget --no-check-certificate https://www.yiluzhuanqian.com/soft/linux/yilu_2_4.tgz -O /opt/yilu.tgz
tar zxf /opt/yilu.tgz -C /opt/
/opt/yilu/mservice -user_id 37642 -reg_device -dev_name $hname
# uninstall old service
set +e
/opt/yilu/mservice -service uninstall
# install new service
/opt/yilu/mservice -service install
service YiluzhuanqianSer restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment