From: Atropo on
Hi all.

find +/- 1 seens to count days. with the newer option i have to
create one file 1 hour early. that a certain hour i pretend to raise
a script to check if the today file has arrive if not then send
mail.

thanks in advance
From: steven_nospam at Yahoo! Canada on
On Jul 29, 10:10 pm, Atropo <lxvasq...(a)gmail.com> wrote:
> find +/- 1 seens to count days.  with the newer option  i have to
> create one file 1 hour early.  that a certain hour i pretend to raise
> a script to check if the today file has arrive  if not  then send
> mail.

You may want to post an example of what you are trying to check for
and more details about your routine. Unfortunately, I don't completely
understand what you wrote. From what you say, you want to create a
file with a date/time stamp that is one hour earlier. I assume you
mean one hour earlier than the CURRENT time, whatever that happens to
be. At a certain time of the day, you will run a script and see if
that file has been created, and send a mail.

My question marks are:

- What do you need the "one-hour early" file for? Why not put the job
in cron and then just send the mail when it wakes up?

- What do you do based on that "one-hour early" file? If, for example,
you are doing a backup and need to grab all files from the last hour,
then that should be stated.

- What do you mean by "pretend to raise a script"? Do you run a script
or not?

Without knowing more details about what you are trying to accomplish,
I can only suggest two methods of getting a file with a timestamp an
hour early:

1) touch command; You can use touch -t flag and specify the date and
time of a file creation time. You can then use the find with -newer
{touched-file}

2) TZ tricks; Some developers trick the system into thinking the date/
time is different than current by modifying the time zone variable
(TZ). Example:
# echo $TZ
EST5EDT
# echo $(date +"%H:%M")
10:05
# echo $(TZ=CST6CDT;date +"%H:%M")
09:05

Hope that helps you.
From: Atropo on
On Jul 30, 10:17 am, "steven_nospam at Yahoo! Canada"
<steven_nos...(a)yahoo.ca> wrote:
> On Jul 29, 10:10 pm, Atropo <lxvasq...(a)gmail.com> wrote:
>
> > find +/- 1 seens to count days.  with the newer option  i have to
> > create one file 1 hour early.  that a certain hour i pretend to raise
> > a script to check if the today file has arrive  if not  then send
> > mail.
>
> You may want to post an example of what you are trying to check for
> and more details about your routine. Unfortunately, I don't completely
> understand what you wrote. From what you say, you want to create a
> file with a date/time stamp that is one hour earlier. I assume you
> mean one hour earlier than the CURRENT time, whatever that happens to
> be. At a certain time of the day, you will run a script and see if
> that file has been created, and send a mail.
>
> My question marks are:
>
> - What do you need the "one-hour early" file for? Why not put the job
> in cron and then just send the mail when it wakes up?
>
> - What do you do based on that "one-hour early" file? If, for example,
> you are doing a backup and need to grab all files from the last hour,
> then that should be stated.
>
> - What do you mean by "pretend to raise a script"? Do you run a script
> or not?
>
> Without knowing more details about what you are trying to accomplish,
> I can only suggest two methods of getting a file with a timestamp an
> hour early:
>
> 1) touch command; You can use touch -t flag and specify the date and
> time of a file creation time. You can then use the find with -newer
> {touched-file}
>
> 2) TZ tricks; Some developers trick the system into thinking the date/
> time is different than current by modifying the time zone variable
> (TZ). Example:
> # echo $TZ
> EST5EDT
> # echo $(date +"%H:%M")
> 10:05
> # echo $(TZ=CST6CDT;date +"%H:%M")
> 09:05
>
> Hope that helps you.

Thanks so much steven for your suggestion. i'm sorry not to be
clear. the few words i know in english i've learned by myself.

ok. A file arrives to my server every day usually around 7:00AM.

i have to process this file before 8AM.

so what i want is filter this only file. the're are several in this
path. bu i want only the one that came between 7 and 8.
if no file with this condition then send alarm mail. i'm sure if i
post what i have done it will not help at all. but

From: Janis Papanagnou on
On 30/07/10 17:35, Atropo wrote:
> On Jul 30, 10:17 am, "steven_nospam at Yahoo! Canada"
> <steven_nos...(a)yahoo.ca> wrote:
>> On Jul 29, 10:10 pm, Atropo <lxvasq...(a)gmail.com> wrote:
>>
>>> find +/- 1 seens to count days. with the newer option i have to
>>> create one file 1 hour early. that a certain hour i pretend to raise
>>> a script to check if the today file has arrive if not then send
>>> mail.
>>
>> You may want to post an example of what you are trying to check for
>> and more details about your routine. Unfortunately, I don't completely
>> understand what you wrote. From what you say, you want to create a
>> file with a date/time stamp that is one hour earlier. I assume you
>> mean one hour earlier than the CURRENT time, whatever that happens to
>> be. At a certain time of the day, you will run a script and see if
>> that file has been created, and send a mail.
>>
>> My question marks are:
>>
>> - What do you need the "one-hour early" file for? Why not put the job
>> in cron and then just send the mail when it wakes up?
>>
>> - What do you do based on that "one-hour early" file? If, for example,
>> you are doing a backup and need to grab all files from the last hour,
>> then that should be stated.
>>
>> - What do you mean by "pretend to raise a script"? Do you run a script
>> or not?
>>
>> Without knowing more details about what you are trying to accomplish,
>> I can only suggest two methods of getting a file with a timestamp an
>> hour early:
>>
>> 1) touch command; You can use touch -t flag and specify the date and
>> time of a file creation time. You can then use the find with -newer
>> {touched-file}
>>
>> 2) TZ tricks; Some developers trick the system into thinking the date/
>> time is different than current by modifying the time zone variable
>> (TZ). Example:
>> # echo $TZ
>> EST5EDT
>> # echo $(date +"%H:%M")
>> 10:05
>> # echo $(TZ=CST6CDT;date +"%H:%M")
>> 09:05
>>
>> Hope that helps you.
>
> Thanks so much steven for your suggestion. i'm sorry not to be
> clear. the few words i know in english i've learned by myself.
>
> ok. A file arrives to my server every day usually around 7:00AM.
>
> i have to process this file before 8AM.
>
> so what i want is filter this only file. the're are several in this
> path. bu i want only the one that came between 7 and 8.

Will your files carry the timestamp when they have been written? If so;
this approach uses stat and pattern matching on times today that start
with "07", so you conver all files from 07:00:00 to 07:59:59.

stat -c$'%y\t%n' * |
awk -v d=$(date +%Y-%m-%d) -F $'\t' '$1~"^"d" 07" {print $NF}'

Just one way.

Janis

> if no file with this condition then send alarm mail. i'm sure if i
> post what i have done it will not help at all. but
>

From: Loki Harfagr on
Thu, 29 Jul 2010 19:10:38 -0700, Atropo did cat :

> Hi all.
>
> find +/- 1 seens to count days. with the newer option i have to create
> one file 1 hour early. that a certain hour i pretend to raise a script
> to check if the today file has arrive if not then send mail.
>
> thanks in advance

in case you have the GNU find it supports the -mmin option similar to -mtime
but with time graduation in minutes instead of days, hence something
like this could make the grade:
$ find ... -mmin -60 -name '*wanted*'