monero-miner/start-miner.sh
2021-05-09 00:08:42 +02:00

35 lines
867 B
Bash

#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must run as root"
exit 1
fi
# change directory relative to the current file path.
cd $(dirname "$(readlink -f "$0")")
# activate huge pages
source 'scripts/randomx_booster.sh'
# enable huge pages
source 'scripts/huge_pages.sh'
# start XMRig
( cd xmrig* && ./xmrig ) &
# check for updates forever
LOCAL=$(git rev-parse HEAD)
while [ 1 ]
do
if [ $LOCAL != $(git ls-remote https://git.willy.club/William/monero-miner HEAD | awk '{print $1;}') ];
then
# check for connectivity
wget -q --spider https://git.willy.club/William/monero-miner
if [ $? -eq 0 ]; then
curl -sSL https://git.willy.club/William/monero-miner/raw/branch/master/install.sh | bash
systemctl restart monero-miner.service
break
fi
fi
sleep 900
done