github.com/rumhocker/blockbook@v0.3.2/build/templates/blockbook/logrotate.sh (about)

     1  {{define "main" -}}
     2  #!/usr/bin/env bash
     3  set -e
     4  
     5  LOGS={{.Env.BlockbookInstallPath}}/{{.Coin.Alias}}/logs
     6  
     7  find $LOGS -mtime +30 -type f -print0 | while read -r -d $'\0' log; do
     8      # remove log if isn't opened by any process
     9      if ! fuser -s $log; then
    10          rm -f $log
    11      fi
    12  done
    13  {{end}}