Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Fedora 3,4- Ubuntu 6.06 to 8.10, Gentoo and Arch
Posts: 408
Rep:
Setting cronjob time interval to a small number
Hi,
I have a web based printing application based on CUPS with billing system for a small lab. Whenever somebody prints from windows machines, it holds the print job and users can release it from the web interface.
Lab admins very often need to print a specific page. So, I don't want the printer to hold jobs for that specific job. I tried to configure CUPS, but I couldn't find such option in it, so I decided to create a script that checks all the held print jobs and release them if they're meeting the condition. I'm planning to create a cronjob that runs this script every five seconds.
The machine connected to the webserver is running a web based application for the internal use and it doesn't have a heavy load. I'm wondering if it is a good practice to run a script every five seconds?
The limit in cron is once per minute, but quite frankly if you want more freq than every 5 mins, I'd write a daemon that just loops and waits some time at the bottom of the loop. Its not worth hammering the system with creating a new process (from cron) every minute or 2, esp if they might overlap. Its a waste of resource.
Distribution: Fedora 3,4- Ubuntu 6.06 to 8.10, Gentoo and Arch
Posts: 408
Original Poster
Rep:
Thanks for responds. I was thinking about wasting the resources by running cron every five seconds, too. I just didn't know any other option. I think having an infinitive loop that sleeps for 5 seconds at the end of each loop is not a good practice, either.
I guess I have to find the solution of my problem by playing around with CUPS setting.
The sleeping is not a problem - don't worry about that. Its the load that the other part of your script that you need to consider. If your system isn't doing much else, don't worry about it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.