xmrig-autoinstall/xmrig-installer.sh

68 lines
1.7 KiB
Bash
Raw Normal View History

2023-03-28 19:39:04 +03:00
source .config
2021-04-18 08:02:16 +03:00
echo "UPDATE / UPGRADE"
apt update
apt upgrade -y ; apt dist-upgrade -y ;
echo "INSTALLING REQ'D PACKAGES"
2021-04-18 11:23:14 +03:00
apt install -y dialog logrotate ntp ntpdate cpulimit ${APT_REQ_PKGS} ;
2021-04-18 08:02:16 +03:00
echo "CREATING DIRECTORIES"
2021-04-19 01:29:31 +03:00
mkdir -p ${INSTALL_DIR}
cd ${INSTALL_DIR}
2021-04-18 08:02:16 +03:00
echo "CLONING XMRIG"
2021-04-19 01:32:42 +03:00
rm -rf ${DIR_NAME}
2021-04-19 01:29:31 +03:00
git clone ${GIT_SRC_URL} ${DIR_NAME}
2021-04-18 08:02:16 +03:00
2021-04-19 01:30:11 +03:00
cd ${DIR_NAME}
2021-04-18 08:02:16 +03:00
echo "CMAKE XMRIG"
2021-04-18 08:34:28 +03:00
cmake ./
2021-04-18 08:02:16 +03:00
echo "MAKE XMRIG"
make
2021-04-18 08:26:45 +03:00
chmod +x xmrig
2021-04-18 08:02:16 +03:00
echo "INSTALLING XMRIG SERVICE"
export $HOSTNAME=$(cat /etc/hostname)
echo "HOSTNAME IS [ ${HOSTNAME} ]"
echo "[Unit]" | tee /etc/systemd/system/xmrig.service
echo "Description=XMRIG service" | tee -a /etc/systemd/system/xmrig.service
echo "After=network.target" | tee -a /etc/systemd/system/xmrig.service
echo "StartLimitIntervalSec=0" | tee -a /etc/systemd/system/xmrig.service
echo "[Service]" | tee -a /etc/systemd/system/xmrig.service
echo "Type=simple" | tee -a /etc/systemd/system/xmrig.service
echo "Restart=always" | tee -a /etc/systemd/system/xmrig.service
echo "RestartSec=3" | tee -a /etc/systemd/system/xmrig.service
echo "User=root" | tee -a /etc/systemd/system/xmrig.service
2021-04-19 01:31:24 +03:00
echo "ExecStart=${INSTALL_DIR}/${DIR_NAME}/xmrig ${POOL_COIN} ${POOL_TLS} -o ${POOL_HOST}:${POOL_PORT} -u ${POOL_USER} -p ${POOL_PASS} ${POOL_LOG} --donate-level=0" | tee -a /etc/systemd/system/xmrig.service
2021-04-18 08:02:16 +03:00
echo "" | tee -a /etc/systemd/system/xmrig.service
echo "[Install]" | tee -a /etc/systemd/system/xmrig.service
echo "WantedBy=multi-user.target" | tee -a /etc/systemd/system/xmrig.service
2021-04-18 10:28:46 +03:00
echo "STARTING XMRIG/SERVICES"
2021-04-18 08:02:16 +03:00
2021-04-18 10:27:57 +03:00
service logrotate start
service ntp start
service xmrig start
2021-04-18 10:28:46 +03:00
echo "STARTING XMRIG/SERVICES @ BOOT"
2021-04-18 10:27:57 +03:00
systemctl enable logrotate
systemctl enable ntp
2021-04-18 08:02:16 +03:00
systemctl enable xmrig
2021-04-18 10:27:57 +03:00
#EOF