Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was just interested how a cron script will effect users of a website? (If at all) I want to execute a script that takes about a minute to execute on a regular basis. Will a dip in performance be noticed? Do I need to keep an eye on anything in particular?

share|improve this question
If the script execution time is not too important and it is affecting performance, use the script with renice which can lower it's priority. – Matt Nov 16 '10 at 3:38

More important than the frequency of execution is the nature of the script that's being executed. If the particular script uses a lot of resources when it executes, then your site users will probably see a lag in performance. It seems to me that a script that takes a minute to execute might be fairly demanding on system resources.

share|improve this answer

It depends on what your script does. If that minute is spent waiting on a couple of network connections you probably don't have a problem. If it hits the disk subsystem or the CPU heavily, that's a different story. Much like any other heavy resource user, a cron script can and will bring a system on its knees.

In general you should see if large tasks can be done incrementaly and you should try to stagger your cron scripts, rather than have them all start at once. That way you spread the load timewise, so that the server resource usage has lower peaks.

IMHO if the task the script executes is something incremental like "collect all new files from /incoming, compress and archive them to that-other-server-in-the-basement", it is better to run it frequently, in order to keep the high load periods shorter.

You could also try running the cron script process under nice/ionice, to give it lower priority when using resources.

PS: Some desktop Linux distributions (you don't mention an OS btw), are under the impression that normal people (which I am apparently not) sleep at 3-4am, so they have all their cron jobs run at about that time, especially on Saturday nights (or Sunday mornings, if you like). Lately they have started staggering their start times at 4:00, 4:15, 4:30 e.t.c., but a few years back they would all start at e.g. 4:00 am. You really don't want to know what that did for the disposition of a tired and cranky coder who was using the machine at that time....

share|improve this answer

This also depends on how often you are executing your script.

The impact will be different depending on how often it is executed (scheduled). You may schedule it to run once per day. At the contrary, you may schedule it to run once every few minutes! This also depends on your needs.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.