Skip to content

Instantly share code, notes, and snippets.

@SpotLabsNET
Last active May 4, 2018 15:53
Show Gist options
  • Save SpotLabsNET/ed5d8930351eb827f0ae2bdb3351cb8b to your computer and use it in GitHub Desktop.
Save SpotLabsNET/ed5d8930351eb827f0ae2bdb3351cb8b to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
Lock00="$AZ_BATCH_NODE_SHARED_DIR/00.lock"
Lock01="$AZ_BATCH_NODE_SHARED_DIR/01.lock"
Lock02="$AZ_BATCH_NODE_SHARED_DIR/02.lock"
Lock03="$AZ_BATCH_NODE_SHARED_DIR/03.lock"
Lock04="$AZ_BATCH_NODE_SHARED_DIR/04.lock"
Lock05="$AZ_BATCH_NODE_SHARED_DIR/05.lock"
if [ -e "$Lock00" ]
then
# install powershell
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list
sudo apt-get update
sudo apt-get install -y powershell
sudo touch "$Lock00"
fi
if [ -e "$Lock01" ]
then
# Blacklist the shitty drivers
echo -e "blacklist nouveau\nblacklist lbm-nouveau\noptions nouveau modeset=0\nalias nouveau off\nalias lbm-nouveau off\n" | sudo tee /etc/modprobe.d/blacklist-nouveau.conf
# Install the NVidia repo
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_7.5-18_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1404_7.5-18_amd64.deb
sudo touch "$Lock01"
fi
if[ -e "$Lock02" ]
then
# Install some basics
sudo apt-get -y install software-properties-common
# Install all of the things
sudo apt-get install git cmake libcryptopp-dev libleveldb-dev libjsoncpp-dev libjsonrpccpp-dev libboost-all-dev libgmp-dev libreadline-dev libcurl4-gnutls-dev ocl-icd-libopencl1 opencl-headers mesa-common-dev libmicrohttpd-dev build-essential cuda -y
sudo touch "$Lock02"
fi
if[ -e "$Lock03" ]
then
# Install the Ethereum repo
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
# Build ethminer
git clone https://github.com/ethereum-mining/ethminer.git
cd ethminer/
mkdir build
cd build
cmake .. -DETHASHCUDA=ON -DETHASHCL=OFF
cmake --build .
sudo make install
cd ~
sudo rm -rf ~/ethminer
sudo touch "$Lock03"
fi
if[ -e "$Lock04" ]
then
# Upgrade the system
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
sudo touch "$Lock04"
fi
if[ -e "$Lock05" ]
then
# Setup Supervisor
sudo apt-get install supervisor -y
echo -e "[program:ethminer]\n/usr/local/bin/ethminer -U -S daggerhashimoto.usa.nicehash.com:3353 -O 3BtgUnw3Rax59p8Fmk4VSgsH1BsYvJH1GP.$AZ_BATCH_ACCOUNT_NAME:x -SP 2 -SC 2 --cuda-schedule auto --cuda-parallel-hash 8\nautostart=true\nautorestart=true\nstderr_logfile=/var/log/ethminer.err.log\nstdout_logfile=/var/log/ethminer.out.log" | sudo tee /etc/supervisor/conf.d/ethminer.conf
sudo shutdown -r +3
sudo touch "$Lock05"
else
echo -e "[program:ethminer]\n/usr/local/bin/ethminer -U -S daggerhashimoto.usa.nicehash.com:3353 -O 3BtgUnw3Rax59p8Fmk4VSgsH1BsYvJH1GP.$AZ_BATCH_ACCOUNT_NAME:x -SP 2 -SC 2 --cuda-schedule auto --cuda-parallel-hash 8\nautostart=true\nautorestart=true\nstderr_logfile=/var/log/ethminer.err.log\nstdout_logfile=/var/log/ethminer.out.log" | sudo tee /etc/supervisor/conf.d/ethminer.conf
sudo supervisorctrl reload all
sudo supervisorctrl restart all
fi
# Setup Cron Job
#echo -e "@reboot /usr/local/bin/ethminer -U -S daggerhashimoto.usa.nicehash.com:3353 -O 3BtgUnw3Rax59p8Fmk4VSgsH1BsYvJH1GP.$AZ_BATCH_ACCOUNT_NAME:x -SP 2 -SC 2 --cuda-schedule auto --cuda-parallel-hash 8" | sudo tee /var/spool/cron/crontabs/root
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment