I'm just about to start scheduling my first cron jobs.

On cPanel it gives this warning:

Warning: You need to have a good knowledge of Linux commands before you can use cron jobs effectively. Check your script with your hosting administrator before adding a cron job.

Am I right in thinking that the script that is called is exactly the same as you would run in a browser, but without the output? And knowledge of Linux comands is only necessary for specifying the file path correctly?

Also, I don't know how to work out how often I can run a script without overloading the server. How is this use of resources measured, and where would I look for the figures? Or is there some rule of thumb?

    Cron jobs can be in any language you want. And the output can be anything you want. For example, if you output all the code for an HTML page, then if defined the log (or email) will actually contain all the output sent through from the PHP script.

    You do need to know some linux so you can give the proper path to your interpreter and script. For example, to use a PHP interpreter on a file, your cron script path would look like:

    /usr/bin/php /home/httpd/vhosts/<domain>/public_html/path/to/cron.php

    Other than that, it's pretty much self explanatory.

      Not really a correction, but on cPanel it would be

      /usr/bin/php /home/<username>/path/to/cron.php

        I haven't used cPanel in so long.... thanks for the correction...

          my cron in cpanel has an extra -f ...not quite sure why but it works.

          /usr/bin/php -f /home/<name>/<path to>/file.php

            -f is the command (file) you want to execute

              Write a Reply...