Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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:
    51
    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:
    56
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Ahmed S

    Ahmed S Member

    Joined:
    Jul 30, 2010
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    51
    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:
    56
    Hello,

    Assuming the code is syntactically correct, yes, your custom code would be run.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. Ahmed S

    Ahmed S Member

    Joined:
    Jul 30, 2010
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    51
    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

    Joined:
    Feb 25, 2010
    Messages:
    1,835
    Likes Received:
    20
    Trophy Points:
    143
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice