For Linux Web Hosting packages and Managed Dedicated Server
Cronjobs are practical when it comes to automating recurring tasks, but they can also affect the function of the website if used improperly. In this article you will learn what to look out for when creating and executing cronjobs.
If you consider the following points, the smooth execution of your cronjobs should be guaranteed:
Allow a minimum of 5 minutes to elapse before repeating a cron job. This prevents your cronjobs from running in parallel and thus slower at times of high server load.
Always add an MAILTO (e.g.: MAILTOemail@example.com) to the top of your Crontab file. This allows you to receive the specific error message conveniently by email.
You can call a cron script using the following binaries:
/usr/bin/php4.4 (/usr/bin/php and /usr/bin/php4 are symlinks)
/usr/bin/php5.2 (/usr/bin/php5 is a symlink)
*/10 * * * * /usr/bin/php5.2 -f /homepages/12/d12345678/htdocs/test.php
- Pay attention to the full path. You can find the absolute path in IONOS under Domains > select appropriate domain > Info
- For PHP scripts executed by a cron job, a stored php.ini is ignored. This means that any changed variables are not set. Alternatively, you can run the PHP script using an HTTP request:
* * * * * /usr/bin/curl -s http://1und1hilfe.de/test.php > /dev/null
If the script is in a protected directory, you must pass the access data using the parameter -u.
For shared hosting packages, we recommend that you always protect the directory with directory protection.
* * * * /usr/bin/curl -s -u user:password http://1und1hilfe.de/test.php > /dev/null
Please note the crontab limits:
|Number of open files||1024||1024|
|Memory||28 MB||512 MB|
|Virtual Memory||128 MB||-|
|Running time||60 seconds||24 hours|
Please note: A maximum of 64 entries are possible in the crontab.