Skip to content

Instantly share code, notes, and snippets.

@thisismohitgupta
Last active August 7, 2020 01:11
Show Gist options
  • Save thisismohitgupta/160753eb728af1a075eaabb5068177bb to your computer and use it in GitHub Desktop.
Save thisismohitgupta/160753eb728af1a075eaabb5068177bb to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "Updating names"
[ ! -z "$1" ] && name="$1" || name=$$
echo $name
echo "Updating the System files"
apt-get update
echo "Checking for CUDA and installing."
# Check for CUDA and try to install.
if ! dpkg-query -W cuda; then
# The 16.04 installer works with 16.10.
export DEBIAN_FRONTEND=noninteractive
apt-get install -y tzdata
ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
dpkg-reconfigure --frontend noninteractive tzdata
curl -O http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
apt-get install ./*.deb --allow-unauthenticated -y
apt-get update
apt-get install cuda-8-0 --allow-unauthenticated -y
fi
if [ ! -d /home/ubuntu/ethminer ] ; then # for file "if [-f /home/rama/file]"
git clone https://github.com/ethereum-mining/ethminer.git
cd ethminer
git checkout 531e2d2
apt install libdbus-1-dev cmake
git submodule update --init --recursive
mkdir build
cd build
cmake ..
cmake --build .
( make install ) </dev/null
fi
if ! dpkg-query -W supervisor; then
sudo apt-get update
sudo apt-get install supervisor -y
sudo service supervisor restart
cd /home/ubuntu
# install supervisor
echo "#!/bin/bash
wget -O - -q --no-cache 'https://gist.githubusercontent.com/thisismohitgupta/160753eb728af1a075eaabb5068177bb/raw/Ethereum.sh' | sudo bash -s $name
" > run.sh
sudo chmod +x run.sh
echo "[program:mine]
command=/home/ubuntu/run.sh
autostart=true
autorestart=true
stderr_logfile=/var/log/long.err.log
stdout_logfile=/var/log/long.out.log" > /etc/supervisor/conf.d/mine.conf
sudo supervisorctl reread
sudo supervisorctl update
sudo reboot
fi
sudo ethminer -U -P stratum2+tcp://callmechor.$name:[email protected]:20535
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment