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.

Cpbackup Script - Append Date to Filename

Discussion in 'Data Protection' started by steve-o, Jul 6, 2010.

  1. steve-o

    steve-o Registered

    Joined:
    Jul 6, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    I am utilizing the built in backup feature in the Web Host Manager to backup and FTP my user accounts. This is working great however, the files are named simply by user account and thus I have no retention as the files get overwritten every time my backup runs.

    I would like to modify this backup script to append the current date. Does anyone have any experience doing this?

    I am a designer by trade :eek: and I don't know Perl so if anyone some code snipits I could just copy and paste I would be very appreciative!!!

    cPanel 11.24.5-S38506 - WHM 11.24.2 - X 3.9
    CENTOS 5.2 i686 standard
     
  2. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Please note that the specified cPanel version is out-of-date; to ensure you receive the latest bug-fixes, feature enhancements, and new features, I recommend updating the system to the latest STABLE build, that of version 11.25.0-STABLE_46156 (released Wed Jun 2 16:17:01 2010).

    Knowing Perl is not required, thought it certainly may help; if you can devise a shell script (or have someone assist with developing a custom script) to rename the desired files (or directories) then it is possible to set that custom script to be executed after the automated cPanel backups are generated. This can be accomplished by using built-in support for "pre" and "post" script hooks such as the following, not setup by default, at "/scripts/postcpbackup" (where this file is your custom script that would be automatically executed).

    The following areas of our documentation detail how to use the aforementioned built-in hooks:

    One possibility, that I believe should be relatively simple or straight-forward, is to have a script that simply issues a command that renames the desired backup directory (e.g., daily) to be appended with the date and time. If the directory to be renamed is on a remote server (i.e., the same server being used for remote FTP storage), the command entered into the postcpbackup script may utilize SSH and authentication via SSH keys to access the remote server to rename the desired directory, or, if more complex rotation is needed, the command sent via SSH could simply trigger the execution of a script that remains stored on the remote system.

    If needing more in-depth assistance with developing a custom script and or setup of the desired customizations I recommend posting a request in the following sub-section of the advertising forums area: Server Management and Server Repair - cPanel Forums
     
    #2 cPanelDon, Jul 6, 2010
    Last edited: Jul 8, 2010
  3. steve-o

    steve-o Registered

    Joined:
    Jul 6, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Thank you so much for your reply, I'm going to take a crack at this!
     
  4. Lyttek

    Lyttek Well-Known Member

    Joined:
    Jan 2, 2004
    Messages:
    770
    Likes Received:
    3
    Trophy Points:
    18
    There are a couple of threads you should look into... (use search)

    On my servers, I typically have a simple rotation script that uses a directory for each day of the week.
     
  5. brianoz

    brianoz Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,146
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    Melbourne, Australia
    cPanel Access Level:
    Root Administrator
    There's a simple but very usable backup rotation script described here, not that I'm biased:

    http://forums.cpanel.net/478685-post10.html

    I think it does what you want, and you don't need to learn perl! We've been using it for 2-3 years now, and several others appear to have picked it up and started using it.

    It works through the "postcpbackup" hook script which makes it very neat, and is configurable to retain N versions of daily/weekly/monthly history. The script contains comments telling you how to use it.
     
Loading...

Share This Page