git.iko.soy/xmrig-bash-scripts
on master help sign in
59 lines 2.0 kB history raw
1#!/bin/bash
3echo "${_GREEN}MINING STARTED${_RESET}"
5# When this script is:
6# * run by crontab, load the settings
7# * run by install, do not load settings
9# Reload settings and functions for when running standalone
10. functions.sh
11. settings.sh
13# if ! screen -list | grep -q "$_XMRIG_SCREEN"; then
15 # Call functions
16 show_settings
17 show_mysettings
18 # start_xmrig
20 # List screen
21 # screen -ls
22# else
24 # List screen
25 # screen -ls
27# fi
28echo "[Unit]" | sudo tee /etc/systemd/system/xmrig.service
29echo "Description=XMRIG service" | sudo tee -a /etc/systemd/system/xmrig.service
30echo "After=network.target" | sudo tee -a /etc/systemd/system/xmrig.service
31echo "StartLimitIntervalSec=0" | sudo tee -a /etc/systemd/system/xmrig.service
32echo "[Service]" | sudo tee -a /etc/systemd/system/xmrig.service
33echo "Type=simple" | sudo tee -a /etc/systemd/system/xmrig.service
34echo "Restart=always" | sudo tee -a /etc/systemd/system/xmrig.service
35echo "RestartSec=3" | sudo tee -a /etc/systemd/system/xmrig.service
36echo "User=root" | sudo tee -a /etc/systemd/system/xmrig.service
37echo "ExecStart=$_XMRIG_BUILD_LOCATION/xmrig --config=$_XMRIG_CONFIG_LOCATION" | sudo tee -a /etc/systemd/system/xmrig.service
38echo "" | sudo tee -a /etc/systemd/system/xmrig.service
39echo "[Install]" | sudo tee -a /etc/systemd/system/xmrig.service
40echo "WantedBy=multi-user.target" | sudo tee -a /etc/systemd/system/xmrig.service
42echo "STARTING XMRIG/SERVICES"
44sudo service logrotate start
45sudo service ntp start
46sudo service xmrig start
48echo "STARTING XMRIG/SERVICES @ BOOT"
50sudo systemctl enable logrotate
51sudo systemctl enable ntp
52sudo systemctl enable xmrig
54echo "${_CYAN}MINING RUNNING${_RESET}"
55echo "${_YELLOW} The process is running in a screen session."
56echo "${_YELLOW} The screen session is named:${_RESET} $_XMRIG_SCREEN"
57echo "${_YELLOW} Command to view process:${_RESET} screen -r $_XMRIG_SCREEN"
58echo "${_MAGENTA} ENJOY!!!${_RESET}"