Skip to main content

Location to save cron jobs

Comments

5 comments

  • Eminds
    If its a script, put it in your public_html folder and add the cron job from your cpanel and that should do the job. If its not working contact your service provider and they will sort it out for you.
    0
  • steveorg
    If its a script, put it in your public_html folder and add the cron job from your cpanel and that should do the job. If its not working contact your service provider and they will sort it out for you.

    Thanks Eminds. I need to be able to do this without going into cPanel. If already placed on the server why would cPanel be necessary?
    0
  • cPanelMichael
    Hello, You won't be able to directly edit the crontab file without root access, but you could develop a PHP script that makes use of the following cPanel API 2 function: cPanel API 2 Functions - Cron::add_line - Software Development Kit - cPanel Documentation You can find examples of using cPanel API 2 with PHP at: GitHub - CpanelInc/xmlapi-php: A PHP Class for Interacting with cPanel's XML-API Thank you.
    0
  • steveorg
    Thanks! Will that work with all hosts or should I check first?
    0
  • cPanelMichael
    Hello, cPanel API 2 functions only require access to cPanel so they should work in a shared environment, but feel free to contact your hosting provider if you'd like to make sure there's nothing in-place to prevent access. Thank you.
    0

Please sign in to leave a comment.