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.

Need help Api addcron not work (port 2082)

Discussion in 'cPanel Developers' started by 9wong, Sep 19, 2013.

  1. 9wong

    9wong Registered

    Joined:
    Sep 19, 2013
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    if i run code. it doesn't add cron to cpanel.
    port 2082 can using api ?
    (i don’t speak very good english, I m thai ^_^)

    Code:
    include("xmlapi.php");
    $ip = "   ";
    $cpuser =  "  ";
    $cppass =  "  ";
    $xmlapi = new xmlapi($ip);
    $xmlapi->set_port(2082);
    $xmlapi->password_auth($cpuser,$cppass);
    
    $xmlapi->set_debug(1);
    $args = array('php /home/myuser/public_html/CronTask.php >/dev/null 2>&1','*','*', '*', '*','*');
    $xmlapi->api2_query($cpuser, 'Cron','add_line', $args);
    
    
     
  2. KostonConsulting

    KostonConsulting Well-Known Member

    Joined:
    Jun 17, 2010
    Messages:
    255
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    San Francisco, CA
    cPanel Access Level:
    Root Administrator
    Hello,
    The $args array needs to be an associative array with the argument names like so:

    Code:
    $args = array('command' => 'php /home/myuser/public_html/CronTask.php >/dev/null 2>&1', 'day' => '*', 'hour' => '*', 'minute' -> '*', 'month' => '*', 'weekday' => '*' );
    
     
Loading...

Share This Page