Super User is a question and answer site for computer enthusiasts and power users. 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've a lot of users in my server using exactly the same cron schedule and this is causing high server load. Can we prevent this?

For example, if there's x numbers of users that use the following cron schedule: 0 1 * * *, is it possible to prevent future users in using the same cron schedule?

share|improve this question
See also… – charlesbridge Mar 22 '13 at 11:28

You can assign cron scheduled per user account:

crontab -e -u user
share|improve this answer
This doesn't prevent two users from using the same schedule. – slhck Mar 22 '13 at 10:44

Why not simply write a script that compares all the user's cron files and moves them on if they conflict? if this is found in several crontabs 0 1 * * * for each conflict that exists change move the minutes along 5 1 * * * and 10 1 * * *. Then simply run this script in the root crontab so that it automatically changes user crontabs often.

If it is crucial that users' cron jobs run at the times they specified you will have to take a look at using PAM limits.

share|improve this answer

If your users simply intend to perform nightly tasks, a solution based on running their ~/ might be simpler.

You would then run «/home/*/», one after another. Of course you would have to run each user's script with her own permissions and in a reasonable environment (cron does these things).

But it might be quite simple. For example:

for user in user0 user1 user2 user3 ... 
   [ -x $script ] || continue 
   sudo -u $user  2>&1 | mail -s "" $user 
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .