#!/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 apt update apt install msr-tools numactl hwloc openssl libmicrohttpd12 git curl wget -y # 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 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