Results 1 to 14 of 14
  1. #1
    Join Date
    May 2007
    Posts
    83
    Hi,
    I need to run my own bash script after CPanel create account, I create postwwwacct and paste there this:
    #!/usr/bin/perl
    my %OPTS = @ARGV;
    my $user = $OPTS{'user'};
    /bin/myscript $user
    But CPanel can't run this script after create account. (chmod is 755).
    My script (in /bin folder) work ok, I test this - I run myscript username and this work, but CPanel can't run this... How to fix or debug this?
    In additional, I really need to run this script (/bin/myscript username) after any CPanel user add domain/subdomain/parked domain, but I don't know how to do this. Please give me advice, this is very important for me.
    Thank you.

  2. #2
    Join Date
    Mar 2009
    Location
    Gods Own Country
    Posts
    681
    Are you sure cpanel is not running /scripts/postwwwacct?
    Whats happens if you use this code in postwwwacct file
    #!/usr/bin/perl
    system("touch /tmp/testfile");
    is "testfile" getting created in /tmp/?

  3. #3
    Join Date
    May 2007
    Posts
    83
    Yes, this script work ok...but cpanel can't run my script

  4. #4
    Join Date
    Mar 2009
    Location
    Gods Own Country
    Posts
    681
    hey, use system() or exec() or backtick to execute a command in perl

  5. #5
    Join Date
    May 2007
    Posts
    83
    system("/bin/myscript $user");
    This will work ok?
    And very important, anybody know how to do this?
    In additional, I really need to run this script (/bin/myscript username) after any CPanel user add domain/subdomain/parked domain, but I don't know how to do this. Please give me advice, this is very important for me.

  6. #6
    Join Date
    Mar 2009
    Location
    Gods Own Country
    Posts
    681
    yea...is it working now?

  7. #7
    Join Date
    May 2007
    Posts
    83
    Yes, it works perfectly! Thank you

  8. #8
    Join Date
    May 2007
    Posts
    83
    Can anybody help me regarding my question:
    In additional, I really need to run this script (/bin/myscript username) after any CPanel user add domain/subdomain/parked domain, but I don't know how to do this. Please give me advice, this is very important for me.

  9. #9
    HostFX-UK Guest
    Great stuff

  10. #10
    Join Date
    Mar 2009
    Location
    Gods Own Country
    Posts
    681
    This might be tricky...theres no straight scripts that cpanel calls, i guess...
    You might have use a cron or something to keep track of new addons, subdomains and parked domains...this is one way that i see...there can be other better ideas too...

  11. #11
    Join Date
    May 2007
    Posts
    83
    Yes, I use cron now...

  12. #12
    HostFX-UK Guest
    Yeah I would do the same.

  13. #13

    This is what I do

    You could also add your script to cpaddonsup script that's being executed after an addon or subdomain is added.

  14. #14
    Quote Originally Posted by SysTeam View Post
    system("/bin/myscript $user");
    This will work ok?
    And very important, anybody know how to do this?
    In additional, I really need to run this script (/bin/myscript username) after any CPanel user add domain/subdomain/parked domain, but I don't know how to do this. Please give me advice, this is very important for me.
    you can use cpanel hook

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •