Last active
March 12, 2020 22:34
-
-
Save psammarco/0400f07cb5a8f697a8ae4195bcccf64f to your computer and use it in GitHub Desktop.
xmrig execution cron script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # This script checks if xmrig is running, logs the status, and if found not to be running, | |
| # opens a detached screen window and execute a second script which contains the xmrig command line. | |
| # | |
| # @latrinelove | |
| logdir=/opt/local/xmrig/logs | |
| scriptsdir=/opt/local/xmrig/scripts | |
| if pgrep -x "xmrig" > /dev/null | |
| then | |
| echo "[$(date "+%d.%m.%Y - %H:%M:%S")] xmrig is running" >> $logdir/status.log | |
| else | |
| echo "[$(date "+%d.%m.%Y - %H:%M:%S")] xmrig is not running" >> $logdir/status.log | |
| fi | |
| if ! pgrep -x "xmrig" > /dev/null | |
| then | |
| screen -dmS xmrig-restarted $scriptsdir/monero-cline.sh && \ | |
| echo "[$(date "+%d.%m.%Y - %H:%M:%S")] xmrig has been restarted" >> $logdir/status.log | |
| fi |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#Monero command line configuration example; Check https://github.com/xmrig/xmrig for more options.
#!/bin/bash
cd /opt/local/xmrig/xmrig-bin
./xmrig -a rx/0 -t 24 -o xmrpool.eu:7777 -u 476EZooPNbqfggSRuAa8Ve3uqez5Sf9mXQaCzMjMdn3AVZ6PpL6Rst79cjRxULnRNeaSFRkaujPnpTCnNs2Fmb2EHMtzWo7 --donate-level=1 --randomx-1gb-pages -p x -k -l /opt/local/xmrig/logs/xmrig-$(date "+%d.%m.%Y-%H.%M").log