Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Aug 1999 12:27:20 -0700 (PDT)
From:      Tani Hosokawa <unknown@riverstyx.net>
To:        Istvan & Agra Baroti <baroti@icmct.uvt.ro>
Cc:        freebsd-newbies@FreeBSD.ORG
Subject:   Re: need short unix program
Message-ID:  <Pine.LNX.4.10.9908021221170.7409-100000@avarice.riverstyx.net>
In-Reply-To: <Pine.BSF.3.96.990802220751.54494A-100000@icmct.uvt.ro>

next in thread | previous in thread | raw e-mail | index | archive | help
Oops.  I read minutes.

#!/usr/bin/perl

while (1) {
   if (fork) {
      sleep 10;
   }
   else {
      ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
      $filename = sprintf "%04i-%02i-%02i.jpg", $year+1900, $mon+1, $mday;
      system "cp /usr/whatever /usr/newplace/$filename";
# could have used 'system "cp /usr/whatever /usr/newplace/`date +%Y-%m-%d`.jpg'
# but that's ugly.  and if you want to step up the pace, spawning a date
# process every second might be bad for you (dunno your machine's
# capacity).
   }
}


On Mon, 2 Aug 1999, Istvan & Agra Baroti wrote:

> 
> 
> On Mon, 2 Aug 1999, Tani Hosokawa wrote:
> 
> > cron job...
> 
> crontab doesn't repeat processes lasting less than 1 minute.
> and I need to repeat the copy process every 10 seconds.
> 
> yours,
> baroti
> 

---
tani hosokawa
river styx internet




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-newbies" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.10.9908021221170.7409-100000>