Location to save cron jobs
I have a cPanel account on a shared server. I do not have root access.
Here's server info from cPanel. I'm not able to run grep.
cPanel Version 64.0 (build 40)
Apache Version 2.4.18
PHP Version 5.6.24
MySQL Version 10.1.26-MariaDB
Architecture x86_64
Operating System linux
I'd like to have PHP create and save cron jobs. What's the proper path to save them?
-
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 -
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 -
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 -
Thanks! Will that work with all hosts or should I check first? 0 -
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.
Comments
5 comments