Description
This function adds a crontab entry.
Warning:
We strongly recommend that you use UAPI instead of cPanel API 2. However, no equivalent UAPI function exists.
Examples
Note:
Use cPanel's API Shell interface (Home >> Advanced >> API Shell) to directly test cPanel API calls.
Parameters
Parameter |
Type |
Description |
Possible values |
Example |
weekday |
string |
Required The day of the week on which the cron job runs. |
|
0 |
minute |
string |
Required The minute of the hour on which the cron job runs. |
An integer between 0 ns 59.
|
0 |
hour |
string |
Required The hour of the day on which the cron job runs. |
An integer between 0 and 23.
|
1 |
day |
string |
Required The day of the month on which the cron job runs. |
An integer between 1 and 31.
|
1 |
month |
string |
Required The month of the year on which the cron job runs. |
An integer between 1 and 12.
|
1 |
command |
string |
Required The command to run. |
A valid string. |
/usr/bin/perl/home/username/happynewyear.pl |
Returns
Return |
Type |
Description |
Possible values |
Example |
linekey |
string |
A unique ID for the line in the crontab file. |
A valid string. |
1 |
statusmsg |
string |
The status of the crontab file |
A valid string. |
crontab installed |
status |
Boolean |
The function call's status. |
|
1 |
reason |
string |
A reason for failure. Note: This function only returns a reasonvalue if it failed. |
A string that describes the error. |
This is an error message. |
result |
Boolean |
Whether the function succeeded. |
|
1 |