monero-miner/start-miner.sh

35 lines
865 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 xmr-stak-rx
( cd 'xmr-stak-rx' && ./xmr-stak-rx ) &
# 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
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