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.

A way to automatically set up cron jobs when account is created?

Discussion in 'General Discussion' started by eugene_b, Oct 3, 2012.

  1. eugene_b

    eugene_b Registered

    Joined:
    Oct 3, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi,

    We have a cPanel server where we host websites of our clients. All the websites are powered by our software which requires several cron jobs to function properly. Is there a way to automatically set up these crons whenever a new account is added? So let's say we add some-site.com. This automatically means that we as well want to set up a cron that does something like
    wget http://some-site.com/index.php?run_scheduler=1 >/dev/null &
    wget http://some-site.com/index.php?run_importer=1&run_scheduler=1 >/dev/null &

    Thanks,
    Eugene B
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    You could create and utilize the following file to complete an action automatically after an account is created:

    Code:
    # /scripts/postwwwacct
    It would involve developing a custom script that automatically creates a specific cron job, and then using the above file to ensure that script runs after account creation. You can find the API documentation for adding cron jobs at:

    API - Cron Jobs

    Thank you.
     
Loading...

Share This Page