Our features site is undergoing a refresh! Be sure to explore the revamped site and discover our latest product roadmap launching here on Monday, March 18th.

Cron limits

Nathan Lierbo shared this idea 12 years ago
Open Discussion

CALL FOR COMMENTS


A root-level user will specify acceptable values for each field in the cron job.


So if you wanted to limit cron jobs to being executed every 15 minutes, you could specify 15,30,45 as valid values for that field in WHM. Then the cPanel interface could detect the server is limiting that field to specific values, and display a drop-down box with those values. For a field where you specify only 1 valid value, that value will always be used and will just be displayed (rather than a drop-down, effectively disabling it from being changed). This will allow system administrators to do creative things like specify "59" as the only valid value for minutes, forcing cron jobs to rotate around the clock so not everyone's cronjob is executing at the top of the hour.


This settings would always apply, even if a cron job is being made for just a single day of the week.


Original thread: http://forums.cpanel.net/f145/cron-limits-case-54937-a-167230.html

Replies (10)

photo
2

yes it is great idea.

photo
4

Very necessary. You should also be able to specify the number of cron jobs that a client can create.

photo
2

This would stop beginners but wouldn't stop people with ssh access or with php or cgi access from adding the cron manually. What could be done to orevent this ?


We're not against minute crons as often they are used to just check if there are any cron jobs to do. It's better to limit users per ressources instad of number of cron jobs.

photo
1

99% of our users use the Cpanel UI to create Cron Jobs. This feature would be very useful for them.

For every other user (1%) we have an script that search all the cronjobs using the Cpanel API: https://documentation.cpanel.net/display/DD/cPanel+API+2+Functions+-+Cron%3A%3Afetchcron

And change them to max "Every 5 minutes"

photo
photo
1

But limit will be really helpful for us. Some user add every minute cron with email notification which can be prevented. Every provider does not provide SSH access so it will be really helpful for us.

photo
1

I think this is a great idea. It's not those that have / can use SSH access that's the issue, its more the ones setting these up through the interface every 1 minute that are the problem.

Yes, resource limiting is available through Cloudlinux, however for the users that aren't particularly 'tech-savvy' they just see their sites not 'doing much' in terms of traffic etc, but are still hitting their resource limits (and in most cases, taking their own sites offline through stupidity).

I think a limitation through the interface only would be fine, as opposed to some concern through crontab -e

WHM -> Tweak Settings -> Limit Cron Frequency = 5,15,30

Once selected, the interface need only remove those from the dropdown of 'custom configurations' when creating the cron.

Yes, of course, this can be worked around by a simple ammend of the cron-line itself, however its at least a deterrent :)

photo
1

Adding my support for this. We just had a client set up three Magento cron jobs to run every minute and caused a huge load on a shared server. I think this comes under the banner of 'protecting against users who don't really understand what they are doing'.

photo
2

Gonna suggest adding another change to help address the OPs issue, as job frequency isn't the only thing that needs to be re-worked:


1. Allow limitations on Cron job frequency.

2. Prepend NICE to all Cron jobs so that they run with lower CPU priority than Apache / MySQL etc. This will help reduce the CPU contention effect that minutely + 15 minutely + hourly crons have on the 0th minute.

photo
1

This would be a relatively small change for the guys at cPanel, yet this task has been set to 'In Discussion' for 7 years.

I think this is essential for larger servers to help mitigate higher CPU usage, and would only require an additional flag in the 'Tweak Settings' interface, such as...

Minimum Frequency for cPanel Cron Tasks - 1m,5m,15m,1h

Its absolutely correct that many clients simply use '1m' due to them just not understanding the implications of having tasks running that frequently.

I think its fair to say this should be given a little attention guys?

photo
1

Cron Limit feature required asap.

photo
1

We really need this feature, where an admin can set the minimum time intervals for cron jobs because users are straining our shared servers with high CPU usage. I have just found one that has set a cron job to run every minute, every hour, every day, every month of the year and it queries the databases. How far is the progress? Can we get a reply from Cpanel?

Leave a Comment
 
Attach a file