Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

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

    Joined:
    Dec 20, 2013
    Messages:
    96
    Likes Received:
    1
    Trophy Points:
    8
    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.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,659
    Likes Received:
    1,427
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page