2021-03-02 20:42:39 +00:00
|
|
|
#!/bin/bash
|
|
|
|
REPOSITORY="https://git.willy.club/William/monero-miner"
|
|
|
|
|
|
|
|
if [[ $EUID -ne 0 ]]; then
|
|
|
|
echo "This script must run as root"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# install dependencies
|
2021-03-02 21:09:09 +00:00
|
|
|
apt update
|
2021-03-03 02:28:46 +00:00
|
|
|
apt install msr-tools numactl hwloc openssl libmicrohttpd12 git curl wget -y
|
2021-03-02 20:42:39 +00:00
|
|
|
|
|
|
|
# clone repository
|
|
|
|
cd /opt/
|
|
|
|
rm -r 'monero-miner'
|
|
|
|
git clone $REPOSITORY monero-miner
|
|
|
|
cd monero-miner
|
|
|
|
|
|
|
|
# create service file
|
|
|
|
echo "[Unit]
|
|
|
|
Description=Monero Miner
|
|
|
|
After=network.target
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
Type=simple
|
|
|
|
ExecStart=bash /opt/monero-miner/start-miner.sh
|
|
|
|
TimeoutStartSec=0
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=default.target" > "/etc/systemd/system/monero-miner.service"
|
|
|
|
systemctl daemon-reload
|
2021-03-02 21:34:08 +00:00
|
|
|
systemctl enable monero-miner.service --now
|
|
|
|
|
|
|
|
# disable suspend and hibernate
|
|
|
|
systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target systemd-logind.service
|
|
|
|
# do this to revert previous changes
|
|
|
|
#systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target systemd-logind.service
|