Bash Script to Monitor and delete old "OG" plots to make room for new NFT plots
Bash Script to Monitor and delete old "OG" plots to make room for new NFT plots
This script uses crontab to monitor a folder containing the old non-poolable plots for Chia, aka OG plots. This only works if you have kept different types of plots in separate folders. The script does not check the plot type so be warned that if you use a folder with NFT plots, those will be deleted also. The script will delete plots when the amount of free space drops below 110,000,000 (110 GB).
Here is the script, called "drivemon.sh".
#!/bin/bash
drv=$1
free=`df --output=target,avail $drv | grep -v "Mount" | cut --fields 2 --delimiter=\ `
if [[ $free -lt 110000000 ]]; then
# if free space is less than 110GB _and_ there are
# OG plots on the drive, delete the oldest plot.
ogcount=`ls $drv/*.plot | wc -l`
if [[ $ogcount -gt 0 ]]; then
rm "$(ls -t $drv/*.plot | tail -1)"
fi
fi
drv=$1
free=`df --output=target,avail $drv | grep -v "Mount" | cut --fields 2 --delimiter=\ `
if [[ $free -lt 110000000 ]]; then
# if free space is less than 110GB _and_ there are
# OG plots on the drive, delete the oldest plot.
ogcount=`ls $drv/*.plot | wc -l`
if [[ $ogcount -gt 0 ]]; then
rm "$(ls -t $drv/*.plot | tail -1)"
fi
fi
And the entry into crontab. (adjust the drive to match your needs)
crontab -e
5,10,15,20,25,30,35,40,45,50,55 * * * * ~/mycode/drivemon.sh /mnt/hdd-b
You may need to make the script executable for crontab.
chmod +x drivemon.sh
Want to help support? | |
Chia (XCH): | xch1xz9g7cyy79vnrh6nuyh86jq4ps6ah2ny0ck2050wfqqfjwkyk0mqd89etp |
HDDcoin (HDD): | hdd19vatjqxka49c5lht6nrf2cqc94va6rf9vv2mzu2793vq4dwq8wes842qff |
Bitcoin (BTC) no fee on Coinbase: | 3ADGMs1i6MU8Bxnr8qC6CPmgTUAS6DevyT |
Etherium (ETH) no fee on Coinbase: | 0x1F604e5a010f42F36e0C24868454f08056bc5B0A |
Venmo: | @steppsr |
Cash App: | $StevenStepp |
![]() |
Comments
Post a Comment