Latrina

logs-cleaner.sh

Apr 12th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.27 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Removes binary data characters dumped by xmrig
  4.  
  5. logfile=/opt/local/xmrig/logs/status.log
  6.  
  7. if perl -nle 'print if m/[^ -~\t\r]/' $logfile |hexdump -C |grep 0 > /dev/null;
  8. then
  9.     perl -i.dirty -ple 's/[^ -~\t\r]//g' $logfile
  10. else
  11.     echo 'nothing to clean'
  12. fi
Add Comment
Please, Sign In to add comment