31 lines
675 B
Bash
31 lines
675 B
Bash
|
#!/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
|
||
|
|
||
|
# 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
|