in reply to Re: Extract data based on dates and place in new file
in thread Extract data based on dates and place in new file

The way the script works now it is using STDIN for starting and ending dates, so I input 20110809 and 20110816 (when I run it on 20110817) and it will extract the information between those dates and output to a file I call dfile. I want the cron job to call the script and automatically capture the required data and send it to the dfile without having to input the dates.
  • Comment on Re^2: Extract data based on dates and place in new file

Replies are listed 'Best First'.
Re^3: Extract data based on dates and place in new file
by jethro (Monsignor) on Aug 10, 2011 at 22:31 UTC

    Ok, so you need to change the script so that it calculates the dates of today and a week before today, instead of getting it from stdin, right? localtime(time()) will give you an array where you can extract year, month and day of today, subtract 7*24*60*60 from time() and you will get the date of one week before.

    If that isn't what you are looking for, be more specific what you want or what isn't working. Post the relevant code. Use the right tags so we can read it, How (Not) To Ask A Question

Re^3: Extract data based on dates and place in new file
by ww (Archbishop) on Aug 10, 2011 at 22:38 UTC

    "...send it to the dfile without having to input the dates. "

    Looks like this is a different question than originally posted?

    Seems that way to me.

    So, check CPAN for modules with "Date" and/or "Time" -- after all, something needs to tell the script that you want Cron to run which dates to check...

    Or, re-write your script with the ASSUMPTION that Crom will run it shortly after midnite; calculate the desired dates from gmtime or localtime, as appropriate.