i**********r 发帖数: 36 | 1 【 以下文字转载自 Linux 讨论区 】
【 原文由 interstellar 所发表 】
I have a directory for certain purpose. Whenever i save a file
to that directory, I need to run a program upon the saved file.
My question is, Can the saving-file event intrigue the invocation
of my program AUTOMATICALLY? If can, how?
thanks!!! | y***y 发帖数: 54 | 2 should be in your "saving" action bah, I don't think the system
can do anything.
are you manually saving or via some program?
【在 i**********r 的大作中提到】 : 【 以下文字转载自 Linux 讨论区 】 : 【 原文由 interstellar 所发表 】 : I have a directory for certain purpose. Whenever i save a file : to that directory, I need to run a program upon the saved file. : My question is, Can the saving-file event intrigue the invocation : of my program AUTOMATICALLY? If can, how? : thanks!!!
| G**T 发帖数: 388 | 3
after the file saved, then trigue another program?
if so, one simple way:
1) check the file's size, if it changes, then
run ur program
else do nothing
2) go to 1. :)
like ur mail notifier
【在 i**********r 的大作中提到】 : 【 以下文字转载自 Linux 讨论区 】 : 【 原文由 interstellar 所发表 】 : I have a directory for certain purpose. Whenever i save a file : to that directory, I need to run a program upon the saved file. : My question is, Can the saving-file event intrigue the invocation : of my program AUTOMATICALLY? If can, how? : thanks!!!
| i**********r 发帖数: 36 | 4 What I want to do is like this:
1)I go to www.spaceflightnow.com
2)I download the daily news with the default name index.html
into that directory, using "save as"
Since this page has a very unsatisfying appearance, I wrote a perl
program to extract the text body from index.html to rearrange into
a new html file.
3)go to an xterm, to run the perl program.
Now I want the system to do the third step, so that I don't need to
shift to another window and type in the command---you know, sometim
【在 y***y 的大作中提到】 : should be in your "saving" action bah, I don't think the system : can do anything. : are you manually saving or via some program?
| D****N 发帖数: 430 | 5 Write a bash script to do everything ah...
wget http://www.spaceflightnow.com/index.html
my_perl_hack index.html
mv index.html `date +%m-%d`.html
【在 i**********r 的大作中提到】 : What I want to do is like this: : 1)I go to www.spaceflightnow.com : 2)I download the daily news with the default name index.html : into that directory, using "save as" : Since this page has a very unsatisfying appearance, I wrote a perl : program to extract the text body from index.html to rearrange into : a new html file. : 3)go to an xterm, to run the perl program. : Now I want the system to do the third step, so that I don't need to : shift to another window and type in the command---you know, sometim
| i**********r 发帖数: 36 | 6 Thanks,
but my situation is a little bit different. I need to surf
the web before I decide which news to download. When I click on
the link to that news, the address showed is not index.html,
but another unpredictable name. When I try to save-as, the
default name appearing in the dialogue box is index.html
【在 D****N 的大作中提到】 : Write a bash script to do everything ah... : wget http://www.spaceflightnow.com/index.html : my_perl_hack index.html : mv index.html `date +%m-%d`.html
| i*******n 发帖数: 166 | 7 run this script in your directory
#!/bin/tcsh -f
while(1)
if ( -e index.html) then
your_perl_script index.html
mv -f index.html `date +%d%m_%H%M`.html
else
sleep 60
endif
end
【在 i**********r 的大作中提到】 : Thanks, : but my situation is a little bit different. I need to surf : the web before I decide which news to download. When I click on : the link to that news, the address showed is not index.html, : but another unpredictable name. When I try to save-as, the : default name appearing in the dialogue box is index.html
| i**********r 发帖数: 36 | 8 do you have any concept about the CPU burden
caused by such a script?
I would rather to use crontab,
【在 i*******n 的大作中提到】 : run this script in your directory : #!/bin/tcsh -f : while(1) : if ( -e index.html) then : your_perl_script index.html : mv -f index.html `date +%d%m_%H%M`.html : else : sleep 60 : endif : end
| i*******n 发帖数: 166 | 9
Yes, I have. The answer is: trivial.
Just like that you feel nothing when you invoke xbiff etc.
Please make an investigation about the CPU burden yourself.
Well, you can use whatever you want.
【在 i**********r 的大作中提到】 : do you have any concept about the CPU burden : caused by such a script? : I would rather to use crontab,
| i**********r 发帖数: 36 | 10 Go to tomb, give me a buzz.
【在 i*******n 的大作中提到】 : : Yes, I have. The answer is: trivial. : Just like that you feel nothing when you invoke xbiff etc. : Please make an investigation about the CPU burden yourself. : Well, you can use whatever you want.
|
|