The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Script based from df -h

Discussion in 'General Discussion' started by Shane3673, Jan 26, 2015.

  1. Shane3673

    Shane3673 Well-Known Member

    Dec 20, 2013
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    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.

Share This Page