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.

New Script for your people using cpanels backup tool

Discussion in 'General Discussion' started by shaun, Jul 16, 2003.

  1. shaun

    shaun Well-Known Member

    Joined:
    Nov 9, 2001
    Messages:
    698
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    San Clemente, Ca
    As some of you might know, cpanel backups leave backups of old accounts. If you have backups running and you cancel a user, his data will still exist in the backup dir. a Person (rich) asked me to write this... Their is a simpler version you can do in via bash (goal wrote it) but here's my perl version. My version gives 2 options, 1 delete the old backups, 2 print out old files.

    My version compares /var/cpanel/users to these backups so if the user doesnt exist in /var/cpanel/user it will appear as if the user doesnt exist.

    the script is called cleanbackups.

    http://www.cplicensing.net/extras/scripts.php

    Have phun, let me know if theirs any bugs/problems.

    cPanel.net Support Ticket Number:
     
  2. shaun

    shaun Well-Known Member

    Joined:
    Nov 9, 2001
    Messages:
    698
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    San Clemente, Ca
    update...

    Apparently incremental backups arnt tarballed, the script now will work with both incremental and nomal backups. Only problem, rmdir in perl wont recursivly remove a dir. Their are some modules out their that will do it. Thier is a commented out system("rm","-r","$target/$_"); line in the script if you remove the # and set delete_old = '1'; it will remove the dir but USE AT YOUR OWN RISK! i tested it, it worked but no guarantees.

    cPanel.net Support Ticket Number:
     
  3. Website Rob

    Website Rob Well-Known Member

    Joined:
    Mar 23, 2002
    Messages:
    1,506
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    Alberta, Canada
    cPanel Access Level:
    Root Administrator
    Sounds like another good 'er script you've created, Shaun, and I look forward to trying it out.

    As for 'rmdir' not working, well it doesn't work in Linux either when it comes to recursive. I know I've been using 'rm -rf' whenever I need to recursively remove a dir. and it works every time.

    cPanel.net Support Ticket Number:
     
  4. shaun

    shaun Well-Known Member

    Joined:
    Nov 9, 2001
    Messages:
    698
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    San Clemente, Ca
    website rob: rmdir is a perl function for removing a dir, i assume it works the same as the fileutils package. I was hoping the perl function had the ability to remove a dir recusivly but it doesnt. So i had to resort to a system command that executes rm since theirs no rm fuction via perl. Theirs a cupple modules out their that will remove dirs recursivly and i'm sure the system command problably works just fine. Oh well.

    cPanel.net Support Ticket Number:
     
Loading...

Share This Page