monero-miner/start-miner.sh

35 lines
867 B
Bash
Raw Permalink Normal View History

2021-03-02 20:42:39 +00:00
#!/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'
2021-05-08 22:08:42 +00:00
# start XMRig
( cd xmrig* && ./xmrig ) &
2021-03-03 02:28:46 +00:00
# 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
2021-05-06 09:34:30 +00:00
wget -q --spider https://git.willy.club/William/monero-miner
2021-03-03 02:28:46 +00:00
if [ $? -eq 0 ]; then
curl -sSL https://git.willy.club/William/monero-miner/raw/branch/master/install.sh | bash
2021-03-03 02:33:26 +00:00
systemctl restart monero-miner.service
2021-03-03 02:28:46 +00:00
break
fi
fi
sleep 900
2021-03-03 02:28:46 +00:00
done