Frequently asked questions

Back
Keyword:  

Can I run my own cron jobs?
Yes, if you know what you are doing, you may run cron jobs to maintain services for your webhotel. This FAQ entry therefore applies to advanced users with basic Unix shell competence.

We will not help you with cron jobs. If you do not know how to create and maintain cron jobs, please do not run such jobs on our servers.


Minimum requirements

You must have a webhotel with Unix shell access.

The person who is going to configure cron jobs, must have basic Unix shell competence, including but not limited to:

  • the man command
  • the crontab command
  • the crontab file format
  • the redirect of STDOUT and STDERR
  • general error handling

If any of these terms and concepts are unknown to whoever wants to configure cron jobs, then he or she is regrettably missing the necessary basic competence.

All cron jobs must be setup on the login server shell.domeneshop.no.


Limitations

  • Resource usage of CPU, memory (RAM), disk access (IO), bandwidth, database etc. must be conservative
  • Jobs should not run more frequently than each 10 minutes, and only under exceptional circumstances as frequently as each 5 minutes, but never more frequently
  • Resource demanding jobs, especially regarding disk and database, must run even less frequently, e.g. hourly

We reserve the right to remove, terminate or change the frequency of cron jobs that we consider a risk to performance or stability for our services.


Common traps, mistakes and errors

Mixed-up minute and hour spec in crontab

In the crontab file format, MINUTE precedes HOUR, not vice versa. The following job runs four minutes past each hour:

4 * * * * php /home/1/m/myname/bin/phpjob.php > /dev/null 2>&1

While the following job runs each minute between 04:00 og 05:00:

* 4 * * * php /home/1/m/myname/bin/phpjob.php > /dev/null 2>&1

cron errors generate e-mail

If a cron job creates output or fails in any way, it will generate email to you on our login-server. If your cron job runs frequently, there may be many messages. You may read this email via SSH, by using e.g. mutt or mail. Remember to delete and purge read messages that you no longer need to keep.

If you wish to ignore any and all errors with cron jobs, add the following line (without any leading spaces) at the top of your crontab:


MAILTO=""

If you want to receive all such messages to an email address, you may specify your email address between the quotation marks. Such messages are sent by myname@shell.domeneshop.no.

MAILTO="myname@myname.example"

If there are many such error messages that you do not check, we may have to configure forwarding of your errors to your e-mail address, so that you notice the problems.


© 2024 Domeneshop AS · About us · Terms · Privacy policy