In the "cut -f 3 -d '|'" from what I understand, this only catching the last 3 lines. I adapted to catch the last 20 lines for now. After that it was faster to purge volumes with errors.
Hello, Elias. Actually cut -f 3 -d '|' is necessary to fetch the volume name from list media. There was, however, an unnecessary tail since I adapted it from another prior script that I posted here before.
a) I think the bellow is better, and should purge all error volumes from a selected pool:
clear && echo "list pools" |bconsole && read -p "Enter the Pool Name you want to purge all error volumes: " pool && for volname in $(echo "list media pool=$pool" |bconsole | grep -e Error | cut -f 3 -d '|' | tr -d " "); do echo purge volume=$volname |bconsole; done
b) Special requests are more expensive =). But with this you can purge all Error volumes:
clear && for volname in $(echo "list media" |bconsole | grep -e Error | cut -f 3 -d '|' | tr -d " "); do echo purge volume=$volname |bconsole; done
c) Just in time: in don't agree with any of this. Probably it would be more prudent to verify reason volumes are turning to error status and fix it. Or, in last case, just change error volumes to Used and then wait retention time expiration.
Regards,
How could I adapt the script to pick up all the volumes with error? This way I can create a cron job to regularly check for the wrong volumes.