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.

Generate Full Backup and Email it : Possible ?!

Discussion in 'E-mail Discussions' started by Binesh, Jan 22, 2005.

  1. Binesh

    Binesh Member

    Joined:
    Oct 7, 2004
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    India
    Hello Everyone,

    Is it possible to generate a zipped full backup of the home directory (or any specified directory as for that matter) and have it mailed to an email account, on a half-monthly basis? I do understand I would need to get a cron thing running, but can someone help me with the script file & cron settings that'd help me achieve my needs please? (yeah, spoon feeding :()

    I'm very new to all of this.
    I would really appreciate any help that I may receive from any of you :)

    ----------------------------------------------------
    General server information:

    • Operating system: Linux
    • Kernel version: 2.4.20-31.9smp
    • Apache version: 1.3.33 (Unix)
    • PERL version: 5.8.1
    • PHP version: 4.3.10
    • MySQL version: 4.0.22-standard
    • cPanel Build: 9.9.8-RELEASE 116
    ------------------------------------------------------

    Thanks for your time and warm regards,
    Binesh
     
  2. rpmws

    rpmws Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    1,824
    Likes Received:
    5
    Trophy Points:
    38
    Location:
    back woods of NC, USA

    sure it's possible ..but you are talking about what could wind up being GB of data easily. Are you prepared for a 20GB file in your Outlook??? hehe
     
  3. Binesh

    Binesh Member

    Joined:
    Oct 7, 2004
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    India
    hehe ... mine is a personal website and the full disk size i utilized as yet is around 300MB, which after compression will reduce considerably yeah? I dont know. I intend to forward it to one of my gmail accounts, so I guess we could go right ahead and tell me how to do it :D

    thank you for replying rmpws! :)
     
  4. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,471
    Likes Received:
    199
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Run a full backup from your cPanel, and set the email address correctly.

    Wait for email to arrive and download.

    What's so tough?
     
  5. Binesh

    Binesh Member

    Joined:
    Oct 7, 2004
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    India
    Specific Directory Back up: How to email this now?!

    Found this script that enables me to backup any specific directory

    Code:
    <?php
    $backupdate = date("Ymd_H-i");
    //Backup date variable. Replace "Ymd" with
    //"Ymd_H-i" to include the time.
    
    $backupdir = "/home/mydomain/public_html/Gallery/albums/";
    //Where are the files located?
    
    $files = "*";
    //What file to backup? Use a * to backup all the files
    //inside the folder entered above.
    
    $backupto = "/home/mydomain";
    //Where to store the tarball?
    
    $fileprefix = "photosbackup";
    //This is the prefix that will be added before the date:
    //(bak_20040326.tar.bz2)
    //The underscore _ is added automatically
    
    $tararg = "-cf";
    //Here goes the tar arguments. I recommend -cf.
    //c is for compressing. f is for outputting
    //a file.
    
    $bz2arg = "-z9";
    //Here goes the bunzip2 arguments. I recommend -z9.
    //z is for creating a archive
    //and 9 is for max compression. z is always needed
    
    //Call the function
    backupsus();
    
    function backupsus() {
    global $backupdate,$backupdir,$backupto,
    $fileprefix,$tararg,$bz2arg,$files;
    $backupsuscmd = "cd $backupdir;
    tar $tararg {$fileprefix}_{$backupdate}.tar $files;
    bunzip2 $bz2arg {$fileprefix}_{$backupdate}.tar;
    mv {$fileprefix}_{$backupdate}.tar.bz2 $backupto";
    passthru ("$backupsuscmd");
    }
    ?>
    NOW, can anyone PLEASE atleast help me with: how to email the generated TAR as an attachment ... a relevant script probably ?! :rolleyes:
     
Loading...

Share This Page