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.

How to add entries to cron through a script

Discussion in 'General Discussion' started by pverma, May 11, 2007.

  1. pverma

    pverma Registered

    Joined:
    May 11, 2007
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    I want my program to run like this:

    a)The webmaster adds a PHP script to cron through the CPanel GUI to run at a fixed time, say 10:00 AM every morning.
    b)When the script is run by cron, it reads an XML file which was added in by the webmaster and contains a list of programs (other PHP scripts) to run at various times during the day
    c)The PHP script adds each of the programs in the XML file to cron and sets them to run at the specified time.

    How can I accomplish (c)? In other words, how can my php script tell CPanel to add some commands to be run at specific times during the day.

    Any pointers will be appreciated and are most welcome.

    -pv
     
  2. brianoz

    brianoz Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,146
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    Melbourne, Australia
    cPanel Access Level:
    Root Administrator
  3. pverma

    pverma Registered

    Joined:
    May 11, 2007
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Yes, but how to do it using a CPanel API?

    The issue is that my web host might hide the crontab file from me, but allow me to make cron settings through CPanel only.
     
  4. brianoz

    brianoz Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,146
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    Melbourne, Australia
    cPanel Access Level:
    Root Administrator
    That doesn't make sense. If they hid it from you, they'd hide it from cpanel (ie the user interface_. The behind the scenes stuff I mentioned above won't be hidden from you ever in normal circumstances.
     
Loading...

Share This Page