Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- limit=20971520 # 20 gygabytes
- batchsize=200 # files to remove by one circle
- walpath="/var/lib/pgsql/pgLogs" # wal archive path
- # cut archive while size is greater than limit
- while [ "$(du -s "${walpath}" | cut -f 1)" -gt "${limit}" ]; do
- echo Remove old WAL
- ls -lhtr ${walpath}/ | head -n ${batchsize} | awk '{print $9}' | xargs -I {} rm -v ${walpath}/{}
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement