cPanel API 2 Functions - Cron::add_line

fmosse

Well-Known Member
Jan 6, 2002
46
1
308
Hi,

I have created a PHP script (based in N1ghteyes/cpanel-UAPI-php-class ) that connects OK to Cpanel and creates a MySQL and a username for it.

I also need to create a Cronjob. I have found cPanel API 2 Functions - Cron::add_line - Developer Documentation - cPanel Documentation

I am using this code:

Code:
require_once "/usr/local/cpanel/php/cpanel.php";

$cpanel = new CPANEL('cpanel_username', 'cpanel_password', 'cpanel.mydomain.com');

// Add a crontab entry.
$dick_clark = $cpanel->api2(
    'Cron', 'add_line',
array(
        'command'        => '/usr/bin/perl/home/username/happynewyear.pl',
        'day'            => '1',
        'hour'           => '0',
        'minute'         => '0',
        'month'          => '1',
        'weekday'        => '*',
    )
);
but it doesnt work. (It doesnt show any error either.)

What should I do?

Thanks,
Francisco
 

fmosse

Well-Known Member
Jan 6, 2002
46
1
308
I run it in a PHP script. It doesn´t show me any error, but it doesn´t create the cronjob either.

Do you have or anyone has a PHP working example that I can upload?

Thanks,
Francisco