Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

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.

Start and stop cron job manually on shared host

Discussion in 'General Discussion' started by Bob Slotpole, Apr 12, 2017.

Tags:
  1. Bob Slotpole

    Bob Slotpole Registered

    Joined:
    Apr 12, 2017
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,427
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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.
     
Loading...

Share This Page