Community Forums
Connect with us on LinkedIn
Closed Thread
Results 1 to 7 of 7
  1. #1
    Member
    Join Date
    Jun 2006
    Posts
    146

    Default way to insert a hook in cpanel's backup manager?

    I want to execute a bash script before a user generates cpanel full backup file or before a user uploads a home directory backup or sql backup, is that possible? I searched for hooks but only find one for cpbackup.

    I hope cPanel can help me. This is very important

    I dont want to edit cpanel's script because they will be overwritten after cpanel update

  2. #2
    Member
    Join Date
    Jun 2006
    Posts
    146

    Default

    I read a related problem here: http://forums.cpanel.net/f42/pre-hoo...ps-120521.html

    The poster was advised to use custom event handler. Unfortunately I do not know perl and I cannot write a perl script. And I don't know what event is called for backup manager's functions.

    Can someone help me with the custom event handler code?

    What i want is pre cpanel full backup generation, pre home directory upload and pre mysql directory upload

    I can only write simple linux bash scripts, so I want the pre cpanel even check to execute a bash script

    Basically I want to disallow cpanel full backup generation if the total files > 50,000 or total files to backup is > 4 GB.

    I also want to disallow home directory upload > 4 GB and mysql upload > 1 GB

    Can someone help me? cPanel developers?

  3. #3
    Integration Developer cPanelDavidN's Avatar
    Join Date
    Dec 2009
    Location
    Houston, TX
    Posts
    525

    Default

    Hi sharmaine001,

    You're correct that a Custom Event Handler is possibly your best/only solution. You can find more about the mechanics of Custom Event Handlers here:
    CustomEventHandler < DevHooks < TWiki

    The documentation references an example of a CustomEventHandler.pm script, /usr/local/cpanel/Cpanel/CustomEventHandler.pm.sample. You can find this on your cPanel installation.

    If you look in that example, you can see how you can make the Perl "system" call which executes a system command. They use 'mkdir' in the example, but you could make a similar call to a Bash script you've made. And based on the return code of your Bash script, the CustomEventHandler can return 1 or 0 to indicate to the parent cPanel process that it should continue and do the backup/restore (or not).

    One thing to note if you decide to do it this way. You should strongly consider sanitizing your variables before passing them to you Bash script, using the "system" Perl command. Anytime you pass arguments to a system or exec function, no matter what language, you should use some type of filtering so only valid data types and characters are handed to the spawned sub-shell.

    Let me know if there's anything else I can help with.

    Regards,
    -David
    David Neimeyer
    Integration Developer

    sdk.cpanel.net
    APIs: XML-API API1 & API2
    Check Out: Developer Downloads Integration Blog
    Need Support? Support Ticket Developer Forum Feature Request

  4. #4
    Member
    Join Date
    Jun 2006
    Posts
    146

    Default

    I did check the samples before I post them here but I really couldn't understand how I can make a call to the bash script in perl and pass variables. I also dont know the API function to call

    Can you please help me develop the event?

    What i want is pre cpanel full backup generation, pre home directory upload and pre mysql directory upload

    Basically I want to disallow cpanel full backup generation if the total files > 50,000 or total files to backup is > 4 GB.

    I also want to disallow home directory upload > 4 GB and mysql upload > 1 GB
    Last edited by sharmaine001; 05-02-2010 at 12:54 PM.

  5. #5
    Member
    Join Date
    Jun 2006
    Posts
    146

    Default

    Sorry to bug you but no help?

  6. #6
    Member
    Join Date
    Jun 2006
    Posts
    146

    Default

    no help from cpanel developers?

  7. #7
    cPanel Development cpanelkenneth's Avatar
    Join Date
    Apr 2006
    Posts
    3,788
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by sharmaine001 View Post
    no help from cpanel developers?
    We don't perform work-for-hire. There are plenty of outside resources you can turn to for custom development.
    Kenneth
    Product Manager
    cPanel, Inc.

Similar Threads & Tags
Similar threads

  1. Unable to insert cron job in cpanel
    By Brightonian in forum New User Questions
    Replies: 15
    Last Post: 03-21-2011, 11:04 AM
  2. RE: How to restore a full backup From File Manager In Cpanel .???
    By mohit1shukla in forum New User Questions
    Replies: 2
    Last Post: 01-10-2011, 05:00 AM
  3. cPanel login hook?
    By quietlurker in forum cPanel Developers
    Replies: 5
    Last Post: 02-25-2010, 09:58 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube