LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 09-18-2008, 06:11 PM   #1
mohtasham1983
Member
 
Registered: Apr 2005
Location: San Jose
Distribution: Fedora 3,4- Ubuntu 6.06 to 8.10, Gentoo and Arch
Posts: 408

Rep: Reputation: 30
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?

Thanks,
 
Old 09-18-2008, 06:30 PM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
You can't use cron to run a script every 5 seconds. The maximum resolution is once per minute.
 
Old 09-18-2008, 08:53 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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.
 
Old 09-18-2008, 09:41 PM   #4
mohtasham1983
Member
 
Registered: Apr 2005
Location: San Jose
Distribution: Fedora 3,4- Ubuntu 6.06 to 8.10, Gentoo and Arch
Posts: 408

Original Poster
Rep: Reputation: 30
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.
 
Old 09-18-2008, 10:28 PM   #5
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting for Number of Logon Failures and Action after that? as400 Solaris / OpenSolaris 3 07-22-2007 10:56 AM
time cronjob rubella Linux - Newbie 2 10-12-2005 10:09 AM
Setting up a small webserver, someone please help rookiepaul Linux - Newbie 4 07-05-2005 10:58 AM
Setting System Time: kernel in wrong time zone warrenweiss Linux - General 7 05-15-2004 03:25 PM
Question about database for small number of people... Whitehat Linux - General 10 12-06-2003 12:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration