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!

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 Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,423
    Likes Received:
    1,956
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice