Script based from df -h
This is more of a Cent-OS question than a CPanel one. I am wanting to create a script to run nightly in cron on a Cent-OS server that just keeps backups on it that are rsync'd to the file server every night from a CPanel server. I can usually hold about 2 months worth of daily backups, one monthly, one daily legacy, and one monthly legacy before the disk is full. Currently I manually go in about once a month to remove the previous month with a rm -fr year-month-* command. I am wanting to build a script that will look at the output of df -h and say /dev/sdb1 is over 95% full so rm -rf previousmonthsyear-previousmonth-*. That way when I forget to check it I am still getting full backups with the most recent data. I am not very fluent in Linux scripting so if I could get some suggestions on the best way to do this that would be awesome.
-
Hello :) You may find this thread helpful: Delete backups after 7 days Thank you. 0
Please sign in to leave a comment.
Comments
1 comment