Start and stop cron job manually on shared host

Bob Slotpole

Registered
Apr 12, 2017
1
0
1
Boston
cPanel Access Level
Website Owner
I'm on a shared hosting plan at Bluehost and set up cron jobs through the cpanel cron job tab. I'm able to specify the periodicity and issue a command to trigger the php script. Is there a way from PHP to issue a cron job and set the periodicity and also from PHP to remove the cron job? Could someone provide a simple example? Thanks
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,224
463
Is there a way from PHP to issue a cron job and set the periodicity and also from PHP to remove the cron job? Could someone provide a simple example?
Hello,

You could utilize the following cPanel API 2 function:

cPanel API 2 Functions - Cron::add_line - Software Development Kit - cPanel Documentation

You may also find the PHP client class helpful when using cPanel API functions with PHP scripts:

GitHub - CpanelInc/xmlapi-php: A PHP Class for Interacting with cPanel's XML-API

Thank you.