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.

Run custom command after cpbackup is complete

Discussion in 'Data Protection' started by Ahmed S, Mar 7, 2011.

  1. Ahmed S

    Ahmed S Member

    Joined:
    Jul 30, 2010
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Is it possible? And if yes, how, to run a custom command/script after cpbackup is complete.

    Regards,
     
  2. MattLee

    MattLee BANNED

    Joined:
    Aug 26, 2009
    Messages:
    83
    Likes Received:
    0
    Trophy Points:
    0
    Hello,

    A large number of our scripts have automatic support for "pre" and "post" run hooks.

    For example, in your case you'd want to create a file at /scripts/postcpbackup. This will be automatically executed by cpbackup after cpbackup is completed if it exists.

    The following areas of our documentation detail how to use the aforementioned built-in hooks:
    Hooking into cPanel Functionality
    cPanel & WHM Script Hooks
     
  3. Ahmed S

    Ahmed S Member

    Joined:
    Jul 30, 2010
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Hey Matt!

    Thanks for the reply. I just want to double check this:

    If I created "/scripts/postcpbackup", whatever code I put there will be executed upon the completion of the cpbackup process, no matter what is is. That includes compressing, uploading, rsync etc... Correct?
     
  4. MattLee

    MattLee BANNED

    Joined:
    Aug 26, 2009
    Messages:
    83
    Likes Received:
    0
    Trophy Points:
    0
    Hello,

    Assuming the code is syntactically correct, yes, your custom code would be run.
     
  5. Ahmed S

    Ahmed S Member

    Joined:
    Jul 30, 2010
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Superb, and it doesn't matter if it's written in Bash, Perl, or Python? Or does it HAVE to be in Perl?
     
  6. cPanelJared

    cPanelJared Technical Analyst
    Staff Member

    Joined:
    Feb 25, 2010
    Messages:
    1,842
    Likes Received:
    18
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    You can use any language you wish, as long as the hashbang (shebang) on the first line of the script specifies the path to the interpreter used for your code's language.
     
Loading...

Share This Page