Latrina

xmrig-cronjob.sh

Oct 7th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.65 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #
  4. # This script checks if xmrig is running, logs the status, and if found not to be running,
  5. # opens a detached screen window and execute a second script which contains the xmrig command line.
  6. #
  7. # @latrinelove
  8.  
  9. bindir=/opt/xmrig
  10.  
  11. if pgrep -x "xmrig" > /dev/null
  12. then
  13.     echo "[$(date "+%d.%m.%Y - %H.%M.%S")] xmrig is running" >> $bindir/status.log
  14. else
  15.     echo "[$(date "+%d.%m.%Y - %H.%M.%S")] xmrig is not running" >> $bindir/status.log
  16. fi
  17.  
  18. if ! pgrep -x "xmrig" > /dev/null
  19. then
  20.      screen -dmS mining-restart /opt/loki-cline.sh && \
  21.      echo "[$(date "+%d.%m.%Y - %H.%M.%S")] xmrig has been restarted" >> $bindir/status.log
  22. fi
Add Comment
Please, Sign In to add comment