How do i monitor files?

How do i monitor files?

Post by ze.. » Tue, 30 Aug 2005 10:05:10



How do i write an infinite loop to monitor the creation and removal of
.pdf or .PDF files under the current directory. Every 15 seconds i want

to display a list of those filenames created or removed after the
previous display. Without loss of practical significance of this
utility, I want to assume that the time interval between creation of a
.PDF or .pdf file and removal of a .PDF or .pdf file is over 15
seconds, which means that it's unnecessary for my script to handle
the situation where creation of a file is followed by immediate removal

of a file. I think i need to use the comm or comm commands here.

 
 
 

How do i monitor files?

Post by r.l. » Tue, 30 Aug 2005 10:34:10




> How do i write an infinite loop to monitor the creation and removal of
> .pdf or .PDF files under the current directory.

Another method, assuming a linux or bsd install, is to look into File
Alternation Monitor (FAM) And its associated 'fileschanged' command or
better, the perl module interface to it.
http://oss.sgi.com/projects/fam/
r.

 
 
 

How do i monitor files?

Post by William Par » Tue, 30 Aug 2005 13:31:07



> How do i write an infinite loop to monitor the creation and removal of
> .pdf or .PDF files under the current directory. Every 15 seconds i
> want to display a list of those filenames created or removed after the
> previous display. Without loss of practical significance of this
> utility, I want to assume that the time interval between creation of a
> .PDF or .pdf file and removal of a .PDF or .pdf file is over 15
> seconds, which means that it's unnecessary for my script to handle the
> situation where creation of a file is followed by immediate removal of
> a file. I think i need to use the comm or comm commands here.

man watch

--

ThinFlash: Linux thin-client on USB key (flash) drive
           http://home.eol.ca/~parkw/thinflash.html
BashDiff: Super Bash shell
          http://freshmeat.net/projects/bashdiff/

 
 
 

How do i monitor files?

Post by ze.. » Tue, 30 Aug 2005 13:44:36


Unix machine hasn't got that command
 
 
 

How do i monitor files?

Post by William Par » Tue, 30 Aug 2005 22:39:58



> Unix machine hasn't got that command

Then, upgrade to Linux.

--

ThinFlash: Linux thin-client on USB key (flash) drive
           http://home.eol.ca/~parkw/thinflash.html
BashDiff: Super Bash shell
          http://freshmeat.net/projects/bashdiff/

 
 
 

How do i monitor files?

Post by Ed Morto » Tue, 30 Aug 2005 22:49:14



> How do i write an infinite loop to monitor the creation and removal of
> .pdf or .PDF files under the current directory. Every 15 seconds i want

> to display a list of those filenames created or removed after the
> previous display. Without loss of practical significance of this
> utility, I want to assume that the time interval between creation of a
> .PDF or .pdf file and removal of a .PDF or .pdf file is over 15
> seconds, which means that it's unnecessary for my script to handle
> the situation where creation of a file is followed by immediate removal

> of a file. I think i need to use the comm or comm commands here.

Something like this (untested) would be the simplest:

ls *.pdf *.PDF > old
while :
do
        sleep 15
        ls *.pdf *.PDF > new
        newOnly=`comm -13 old new`
        oldOnly=`comm -23 old new`
        echo "created: $newOnly"
        echo "removed: $oldOnly"
        mv new old
done

Check the "comm" man page for the arguments.

Regards,

        Ed.

 
 
 

How do i monitor files?

Post by ze.. » Wed, 31 Aug 2005 06:36:29




> > How do i write an infinite loop to monitor the creation and removal of
> > .pdf or .PDF files under the current directory. Every 15 seconds i want

> > to display a list of those filenames created or removed after the
> > previous display. Without loss of practical significance of this
> > utility, I want to assume that the time interval between creation of a
> > .PDF or .pdf file and removal of a .PDF or .pdf file is over 15
> > seconds, which means that it's unnecessary for my script to handle
> > the situation where creation of a file is followed by immediate removal

> > of a file. I think i need to use the comm or comm commands here.

> Something like this (untested) would be the simplest:

> ls *.pdf *.PDF > old
> while :
> do
>    sleep 15
>    ls *.pdf *.PDF > new
>    newOnly=`comm -13 old new`
>    oldOnly=`comm -23 old new`
>    echo "created: $newOnly"
>    echo "removed: $oldOnly"
>    mv new old
> done

> Check the "comm" man page for the arguments.

Thanks Ed for your advice, that is similiar to what i have written
here. However, i have been testing my syntax, which is similiar to
yours, and still doesn't seem to work. Have a look at my code ,and tell
me if you see anything out of ordinary.

   UW PICO(tm) 3.5                  File: pdf.sh

ls *.[pP][dD[fF] >older 2>/dev/null

while true

do

sleep 15echo "No pdf files have been created or removed in the last 15

ls *.[pP][dD[fF] >newer 2>/dev/null
count='comm -13 $A $B | wc l'

else    if [ $count -gt 0 ]; then
        echo "No pdf files have been created or removed in the last
1515
        seconds"conds"
        comm -23 $A $B$A $B comm -12
        comm -13 $A $B

else
        echo" The following pdf file(s) have been removed in the last
15
              seconds"
unalias pdf.sh

done

If you can test the code on your unix machine cutting and pasting, and
seeing what's causing the issue. I'm interesting to see what i am doing
wrong. Appreciate it bud!

Cheers,

Peri....

- Show quoted text -

 
 
 

How do i monitor files?

Post by Ed Morto » Wed, 31 Aug 2005 07:16:06





>>>How do i write an infinite loop to monitor the creation and removal of
>>>.pdf or .PDF files under the current directory. Every 15 seconds i want

>>>to display a list of those filenames created or removed after the
>>>previous display. Without loss of practical significance of this
>>>utility, I want to assume that the time interval between creation of a
>>>.PDF or .pdf file and removal of a .PDF or .pdf file is over 15
>>>seconds, which means that it's unnecessary for my script to handle
>>>the situation where creation of a file is followed by immediate removal

>>>of a file. I think i need to use the comm or comm commands here.

>>Something like this (untested) would be the simplest:

>>ls *.pdf *.PDF > old
>>while :
>>do
>>        sleep 15
>>        ls *.pdf *.PDF > new
>>        newOnly=`comm -13 old new`
>>        oldOnly=`comm -23 old new`
>>        echo "created: $newOnly"
>>        echo "removed: $oldOnly"
>>        mv new old
>>done

>>Check the "comm" man page for the arguments.

> Thanks Ed for your advice, that is similiar to what i have written
> here. However, i have been testing my syntax, which is similiar to
> yours, and still doesn't seem to work. Have a look at my code ,and tell
> me if you see anything out of ordinary.

>    UW PICO(tm) 3.5                  File: pdf.sh

> ls *.[pP][dD[fF] >older 2>/dev/null

You're missing a closing square bracket ] after the "D" above.

Quote:> while true

> do

> sleep 15echo "No pdf files have been created or removed in the last 15

The above is missing a newline and a closing double quote ".

Quote:

> ls *.[pP][dD[fF] >newer 2>/dev/null

You're missing a closing square bracket ] after the "D" above.

Quote:> count='comm -13 $A $B | wc l'

The above forward ticks ' should be back ticks `. Or use $(...) syntax.

Quote:

> else    if [ $count -gt 0 ]; then
>         echo "No pdf files have been created or removed in the last
> 1515
>         seconds"conds"

The above seems to have an extra double quote in addition to messed up
newlines.

Quote:>         comm -23 $A $B$A $B comm -12

The above is just messed up.

Quote:>         comm -13 $A $B

> else
>         echo" The following pdf file(s) have been removed in the last
> 15
>               seconds"

Messed up newlines.

Quote:> unalias pdf.sh

What's the above supposed to do?

Quote:> done

> If you can test the code on your unix machine cutting and pasting, and
> seeing what's causing the issue. I'm interesting to see what i am doing
> wrong. Appreciate it bud!

Regards,

        Ed.

 
 
 

How do i monitor files?

Post by ze.. » Wed, 31 Aug 2005 07:26:12




> > How do i write an infinite loop to monitor the creation and removal of
> > .pdf or .PDF files under the current directory. Every 15 seconds i want

> > to display a list of those filenames created or removed after the
> > previous display. Without loss of practical significance of this
> > utility, I want to assume that the time interval between creation of a
> > .PDF or .pdf file and removal of a .PDF or .pdf file is over 15
> > seconds, which means that it's unnecessary for my script to handle
> > the situation where creation of a file is followed by immediate removal

> > of a file. I think i need to use the comm or comm commands here.

> Something like this (untested) would be the simplest:

> ls *.pdf *.PDF > old
> while :
> do
>    sleep 15
>    ls *.pdf *.PDF > new
>    newOnly=`comm -13 old new`
>    oldOnly=`comm -23 old new`
>    echo "created: $newOnly"
>    echo "removed: $oldOnly"
>    mv new old
> done

> Check the "comm" man page for the arguments.

Thanks Ed for your advice, that is similiar to what i have written
here. However, i have been testing my syntax, which is similiar to
yours, and still doesn't seem to work. Have a look at my code ,and tell
me if you see anything out of ordinary.

   UW PICO(tm) 3.5                  File: pdf.sh

ls *.[pP][dD[fF] >older 2>/dev/null

while true

do

sleep 15echo "No pdf files have been created or removed in the last 15

ls *.[pP][dD[fF] >newer 2>/dev/null
count='comm -13 $A $B | wc l'

else    if [ $count -gt 0 ]; then
        echo "No pdf files have been created or removed in the last
1515
        seconds"conds"
        comm -23 $A $B$A $B comm -12
        comm -13 $A $B

else
        echo" The following pdf file(s) have been removed in the last
15
              seconds"
unalias pdf.sh

done

If you can test the code on your unix machine cutting and pasting, and
seeing what's causing the issue. I'm interesting to see what i am doing
wrong. Appreciate it bud!

Cheers,

Peri....

- Show quoted text -

 
 
 

How do i monitor files?

Post by ze.. » Wed, 31 Aug 2005 07:31:21


It's a unix server that i VPN that is external
 
 
 

How do i monitor files?

Post by ze.. » Wed, 31 Aug 2005 09:47:28






> >>>How do i write an infinite loop to monitor the creation and removal of
> >>>.pdf or .PDF files under the current directory. Every 15 seconds i want

> >>>to display a list of those filenames created or removed after the
> >>>previous display. Without loss of practical significance of this
> >>>utility, I want to assume that the time interval between creation of a
> >>>.PDF or .pdf file and removal of a .PDF or .pdf file is over 15
> >>>seconds, which means that it's unnecessary for my script to handle
> >>>the situation where creation of a file is followed by immediate removal

> >>>of a file. I think i need to use the comm or comm commands here.

> >>Something like this (untested) would be the simplest:

> >>ls *.pdf *.PDF > old
> >>while :
> >>do
> >>   sleep 15
> >>   ls *.pdf *.PDF > new
> >>   newOnly=`comm -13 old new`
> >>   oldOnly=`comm -23 old new`
> >>   echo "created: $newOnly"
> >>   echo "removed: $oldOnly"
> >>   mv new old
> >>done

> >>Check the "comm" man page for the arguments.

> > Thanks Ed for your advice, that is similiar to what i have written
> > here. However, i have been testing my syntax, which is similiar to
> > yours, and still doesn't seem to work. Have a look at my code ,and tell
> > me if you see anything out of ordinary.

> >    UW PICO(tm) 3.5                  File: pdf.sh

> > ls *.[pP][dD[fF] >older 2>/dev/null

> You're missing a closing square bracket ] after the "D" above.

> > while true

> > do

> > sleep 15echo "No pdf files have been created or removed in the last 15

> The above is missing a newline and a closing double quote ".

> > ls *.[pP][dD[fF] >newer 2>/dev/null

> You're missing a closing square bracket ] after the "D" above.

> > count='comm -13 $A $B | wc l'

> The above forward ticks ' should be back ticks `. Or use $(...) syntax.

> > else    if [ $count -gt 0 ]; then
> >         echo "No pdf files have been created or removed in the last
> > 1515
> >         seconds"conds"

> The above seems to have an extra double quote in addition to messed up
> newlines.

> >         comm -23 $A $B$A $B comm -12

> The above is just messed up.

> >         comm -13 $A $B

> > else
> >         echo" The following pdf file(s) have been removed in the last
> > 15
> >               seconds"

> Messed up newlines.

> > unalias pdf.sh

> What's the above supposed to do?

> > done

> > If you can test the code on your unix machine cutting and pasting, and
> > seeing what's causing the issue. I'm interesting to see what i am doing
> > wrong. Appreciate it bud!

> Regards,

>    Ed.

I know it is a mess, but this is the code that somebody else said to me
was good. I am still having problems with my syntax

count='comm -13 $A $B | wc l'

It's telling me that count is unexpected in my code

 
 
 

How do i monitor files?

Post by Ed Morto » Wed, 31 Aug 2005 13:49:09





<snip>
>>>count='comm -13 $A $B | wc l'

>>The above forward ticks ' should be back ticks `. Or use $(...) syntax.

<snip>

Quote:> I am still having problems with my syntax

> count='comm -13 $A $B | wc l'

> It's telling me that count is unexpected in my code

Hmm, what COULD that be..... Please read my previous posts, fix your
code as suggested, and retry before following up.

        Ed.

 
 
 

How do i monitor files?

Post by Bill Marcu » Thu, 01 Sep 2005 04:23:10




> I know it is a mess, but this is the code that somebody else said to me
> was good. I am still having problems with my syntax

> count='comm -13 $A $B | wc l'

> It's telling me that count is unexpected in my code

If these two lines look exactly the same, change your font.
count='comm -13 $A $B | wc -l'
count=`comm -13 $A $B | wc -l`

The message "count unexpected" means there is a mistake prior to that
line.

--
Knowledge, sir, should be free to all!
                -- Harry Mudd, "I, Mudd", stardate 4513.3

 
 
 

1. copying files from unix to dos system in dos readable format

I have installed linux on my 486, I don't have any knowledge on copying
files from a linux system to a dos floppy. Actually I want to copy a few
man's from the system on a dos formatted floppy and print the mans on a
win95 system in my office for later reading.

for further knowledge:-
I can mount a floppy
I can format a floppy for linux file system
I can direct the output of man <command> to a floppy in a file called
<filename>
I can check the copied text files on floppy using more <filename>

I cannot make the floppy readable on a doz or windoz based system.

Please Help !!

Thanks in advance!

Tualha Khan

2. Htaccess Dictionary Attack using HEAD Method

3. I don t understand the eand if file unexepected expecting done, done is ?

4. Are UNIX IPC message queues bad?

5. SCSI-DAT s/w like tar for DOS to exchange files LINUX <--> DOS?

6. PORT-Defintion!

7. How can Dos partitions & Dos files be viewed in Linux ?

8. Tru64 5.1a and LX164 SRM Console

9. HELP: Connectivity between DOS/DOS and DOS/Linux

10. Is there a gas preprossesor to convert dos masm .asm files to gas .S files

11. Dos/Win(vfat) file to Linux file (ext2) conversion utility

12. Tie::File truncates large files when doing a shift

13. Can msdos file system handle double space DOS file system ?