Loading ...
Sorry, an error occurred while loading the content.

RE: [PBML] restrict script to run once a day

Expand Messages
  • Andrew G. Hammond
    usually you use a /tmp file to do this kind of stuff: my $key = /tmp/.key ; my $day = 24 * 60 * 60; # 24 hrs x 60 min x 60 sec my @stats = stat $key; die
    Message 1 of 2 , Sep 30, 2002
    • 0 Attachment
      usually you use a /tmp file to do this kind of stuff:

      my $key = '/tmp/.key';
      my $day = 24 * 60 * 60; # 24 hrs x 60 min x 60 sec

      my @stats = stat $key;
      die "I'm only allowed to run once every 24 hours!\n"
      unless time - $day > $stats[9] # stats[9] is mtime of file

      open KEY, '>', $key; # touch file
      close KEY;

      -----Original Message-----
      From: Priss [mailto:priss_uk_2000@...]
      Sent: Monday, September 30, 2002 3:15 AM
      To: perl-beginner@yahoogroups.com
      Subject: [PBML] restrict script to run once a day


      Hiya,

      What is the best way to restrict my script only allow
      to run once a day? I am going to put it in my crontab
      but incase someone run it manually by mistake.

      Thanks...

      Priss

      __________________________________________________
      Do You Yahoo!?
      Everything you'll ever need on one web page
      from News and Sport to Email and Music Charts
      http://uk.my.yahoo.com


      Unsubscribing info is here:
      http://help.yahoo.com/help/us/groups/groups-32.html

      Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    Your message has been successfully submitted and would be delivered to recipients shortly.