Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Member
    Join Date
    Feb 2006
    Posts
    73

    Default easy way to delete backups of non-existant accounts?

    backup space is always an issue, especially with incremental backups. I'm wondering in an effort to save space if it is possible for some script or something that could automatically remove old backups of accounts that don't exist anymore? When you have hundreds of accounts it is a real hassle to do this manually.

  2. #2
    Member
    Join Date
    Jul 2002
    Posts
    350

  3. #3
    Member
    Join Date
    Nov 2006
    Posts
    340

    Default

    I tried that script but getting this error.

    [/scripts]# ./cleanbackups
    Reading Backup Config...Complete
    Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.3/FAQ

  4. #4
    Member
    Join Date
    Jun 2008
    Location
    Indiana, USA
    Posts
    105

    Default

    Something that I'm running that may help is a cron job that deletes backup files that are older than 72 hours... So if you were doing daily backups any account that isn't backed up for 3 consecutive days would be pushed out of the system.

    If you were doing weekly backups you could adjust it to 8 days or 15 days if you wanted.

    You obviously would want to adjust the paths to the specifics of your server:
    Code:
    0 0 * * * find /backup -maxdepth 3 -name 'backup-*.tar.gz' -mtime +3 -exec rm {} \; ; find /backup -maxdepth 3 -name 'cpmove-*.tar.gz' -mtime +3 -exec rm {} \;
    Michael Denney
    MDDHosting LLC
    http://www.mddhosting.com/

  5. #5
    Member
    Join Date
    Nov 2006
    Posts
    340

    Default

    That didn't do anything for me.

  6. #6
    Member
    Join Date
    Dec 2003
    Location
    France
    Posts
    300
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    This is what we use :
    Code:
    bakdir=$(grep BACKUPDIR /etc/cpbackup.conf | awk '{print $2}');cd "$bakdir"/cpbackup/daily/;for user in *;do if [ ! -e "/var/cpanel/users/"$user"" ] && [ "$user" != "files" ] && [ "$user" != "dirs" ]; then rm -rf "$bakdir"/cpbackup/*/"$user";fi;done
    Replace daily with weekly or monthly if you don't have daily backups.
    Marie - Co-Owner
    Need Further Assistance ? Here you go !
    English, french and spanish support

  7. #7
    Member
    Join Date
    Nov 2006
    Posts
    340

    Default

    What is the non-cron command to run manually?

  8. #8
    Member
    Join Date
    Dec 2003
    Location
    France
    Posts
    300
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    My command is not a cron command, and will delete all backups of non existent accounts.
    If you want to run it automatically, your best option is to add it to /scripts/postcpbackup (create it if it doesn't already exist), so it will be executed after cpbackup is complete.
    Marie - Co-Owner
    Need Further Assistance ? Here you go !
    English, french and spanish support

  9. #9
    Member
    Join Date
    Nov 2004
    Location
    Earth
    Posts
    151

  10. #10
    cPanel Partner NOC This forum account has been confirmed by cPanel staff to represent a vendor.cPanel Partner NOC Badge
    Join Date
    Nov 2001
    Location
    San Clemente, Ca
    Posts
    703

    Default

    Quote Originally Posted by Zion Ahead View Post
    I tried that script but getting this error.

    [/scripts]# ./cleanbackups
    Reading Backup Config...Complete
    Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.3/FAQ
    The above plug-in replaces that script. The plug-in gives you many more features and the ability to automate the process!
    Shaun Reitan
    NDCHost.com - cPlicensing.net - ProVPS.com
    Contact us for your cPanel Licensing needs! We Price Match, We provide Support, We take care of our customers!

Similar Threads & Tags
Similar threads

  1. Too easy to delete public_html via FTP user window
    By akmiecik in forum New User Questions
    Replies: 1
    Last Post: 08-10-2011, 07:57 AM
  2. How do I delete old backups?
    By cmkelly29 in forum New User Questions
    Replies: 3
    Last Post: 10-19-2009, 09:37 PM
  3. Easy way to delete 80000k emails?
    By razorhazor in forum cPanel and WHM Discussions
    Replies: 15
    Last Post: 07-12-2009, 11:25 AM
  4. how to delete old backups automatically?
    By dhecker in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 02-20-2004, 10:57 AM
  5. It's too easy to delete MySQL databases via Cpanel!
    By Valetia in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 02-15-2004, 12:08 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube