1 |
On 07/10/13 11:21, Alan McKinnon wrote: |
2 |
>On 09/07/2013 18:54, Joseph wrote: |
3 |
>> How to design a sticky note pop-up when file is present? |
4 |
>> |
5 |
>> I would like to check if file is present via and open a terminal window |
6 |
>> with a simple message. |
7 |
>> I think a simple bash script and a cron job would do the trick or is |
8 |
>> there a better solution? |
9 |
>> |
10 |
>> I've tried cron + bash script |
11 |
>> |
12 |
>> cron: |
13 |
>> 32 10 * * * sh /home/joseph/xp_share/wall.sh |
14 |
>> |
15 |
>> wall.sh |
16 |
>> terminal |
17 |
>> wall file ready |
18 |
>> |
19 |
>> When I open terminal and type: "terminal" new windows pops up |
20 |
>> But if close all the terminals and run wall.sh script the terminal will |
21 |
>> not open. |
22 |
>> I get an error message: (terminal:24945): Gtk-WARNING **: cannot open |
23 |
>> display: |
24 |
>> |
25 |
> |
26 |
> |
27 |
>You want inotify for this. |
28 |
> |
29 |
>You are polling something to discover if it's there, what yu really want |
30 |
>to do is let the kernel notify you when the event you are interested in |
31 |
>occurs. |
32 |
> |
33 |
>There are many tools out there that interface with the kernel's inotify |
34 |
>system. |
35 |
> |
36 |
> |
37 |
>-- |
38 |
>Alan McKinnon |
39 |
>alan.mckinnon@×××××.com |
40 |
|
41 |
Thanks Alan, yes I'm looking into it and your are the second person who suggested to me "inotify" is the tool for the job. |
42 |
I've installed inotify-tools but I think I will need to find more samples to make it to work :-) |
43 |
|
44 |
I just want to monitor one file in a directory. |
45 |
I usually copy the file over the network to another computer (same file name) I'll overwrite the file. |
46 |
|
47 |
Once I copy the file, the system should notify a use that new file exist (a message pop-up). If the use closes the message and will not open the file, after few |
48 |
ours I want to remind the user that the file has not been open yet. |
49 |
|
50 |
Will it be very complicated to write a bash script like this? |
51 |
|
52 |
-- |
53 |
Joseph |