svlug_chron_limited_to_mins

This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.



Date: Thu, 17 May 2001 15:46:48 -0700
To: svlug@lists.svlug.org
Subject: Re: [svlug] Crontab
From: Rick Moen <rick@linuxmafia.com>

begin  garry@gjackson.org quotation:
> I was wondering if anyone would happen to know if there is a way to do
> seconds in the crontab.  I am setting a webcam up and need a way to have a
> script ran every 10 to 20 seconds.

As far as I can tell, both cron and "at" have granularity down to the
level of minutes, but no lower.

===
Date: Thu, 17 May 2001 16:05:48 -0700 (PDT)
From: Gerard R Lazo <lazo@pw.usda.gov>
Subject: Re: [svlug] Crontab
To: svlug@lists.svlug.org

> > begin  garry@gjackson.org quotation:
> > I was wondering if anyone would happen to know if there is a way to do
> > seconds in the crontab.  I am setting a webcam up and need a way to have a
> > script ran every 10 to 20 seconds.
> 
> begin  rick@linuxmafia.com quotation:
> As far as I can tell, both cron and "at" have granularity down to the
> level of minutes, but no lower.
> 

You may as well just start something that will pause or sleep before 
re-executing again, rather than continually trying to re-initiate it.


===

Date: Thu, 17 May 2001 16:25:50 -0700 (PDT)
From: "Dagmar d'Surreal" <dagmar@dsurreal.org>
To: garry@gjackson.org
Subject: Re: [svlug] Crontab

On Thu, 17 May 2001 garry@gjackson.org wrote:

> I was wondering if anyone would happen to know if there is a way to do
> seconds in the crontab.  I am setting a webcam up and need a way to have a
> script ran every 10 to 20 seconds.
> 
> Thank you in advance,
> Garry Jackson

Crond would become a burden on the system if it happened to have a rather
large table of cron jobs to perform and it were called every
second.  The safe solution here is to simply either write a cheap little
daemon, or just have a cron job call your script every minute, and have
that script execute say, five times with 10 second sleeps in-between.
Of course, there's going to be some drift if the job your script calls
takes longer than a blink or two to complete.  I recommend having the
script spawn subshells (using &) in-between sleeps.  Something like...

#!/bin/sh
# Five-smacks on the dollar
for dollar in 1 2 3 4 5; do
  smack.sh &
  sleep 10
done

...will solve most of the problem.


===

the rest of The Pile (a partial mailing list archive)

doom@kzsu.stanford.edu