Skip to main content

Run command post account create

Comments

4 comments

  • cPanelMichael
    Hello :) You could utilize the /scripts/postwwwacct file. You can find a blog on this at: [url=http://cpanel.net/frequently_asked_scripts_how_do_i_automate_xyz_after_creating_an_account/]Frequently Asked Scripts: "How do I automate XYZ after creating an account?" Documentation is available at: [url=http://docs.cpanel.net/twiki/bin/view/AllDocumentation/ScriptHooks#/scripts/postwwwacct]ScriptHooks < Postwwwacct Thank you.
    0
  • KostonConsulting
    I'd recommend using the Standardized Hooks system instead of /scripts/postwwwacct. There can only be one /scripts/postwwwacct script so you can run into trouble if any third-party add-ons are coded to use it as well. With Standardized hooks, you don't have any chance that your hook will be overwritten. Also, since you want to perform one action as the user and one as root, Standardized Hooks will allow you to have 2 different hooks in place, running as each uid. If you need those actions to be performed in sequence, you may need to built a timer into the root hook to wait for the first action. [url=http://docs.cpanel.net/twiki/bin/view/SoftwareDevelopmentKit/StndHooksWHMFunctions#Whostmgr::Accounts::Create]WHM Functions | Standardized Hooks (post
    0
  • JamieD
    Thanks for the info Dave, very useful. I take it then there is no order to the Standardized Hooks system, or is it that the scripts are run in parallel? The first command generates a file in the users home so I can set the other script to wait for the file to exist before running it's operations. The Whostmgr::Accounts::Create (post) hook documentation shows it runs as root, is there a way to get the script to run as the user or would this be the job of the script to do this? Thanks
    0
  • KostonConsulting
    [quote="JamieD, post: 1475151">Thanks for the info Dave, very useful. I take it then there is no order to the Standardized Hooks system, or is it that the scripts are run in parallel?
    The hooks are entered in a specific order in /var/cpanel/hooks.yaml so I'd imagine that they are just loaded up into an array and executed in that order but I'd do some testing as if they are loaded into a hash, they may not have a constant order of execution. [QUOTE] The first command generates a file in the users home so I can set the other script to wait for the file to exist before running it's operations. The Whostmgr::Accounts::Create (post) hook documentation shows it runs as root, is there a way to get the script to run as the user or would this be the job of the script to do this? Thanks
    Yea, you'll have to use setuid() or your preferred method of changing to the uid that you need. I'm not aware of anything built-in to de-escalate, only the other way around.
    0

Please sign in to leave a comment.