LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Send e-mail alert when file size changing (https://www.linuxquestions.org/questions/linux-newbie-8/send-e-mail-alert-when-file-size-changing-4175592480/)

freeroute 10-29-2016 10:17 AM

Send e-mail alert when file size changing
 
I would like to send e-mail alert for me and play a sound when a text file changed (for example append one row into to file ). How can I do that?
I guess bash programming, but I don't know how to do this.
No GUI, only CLI interface.

OS: GNU/Debian
Could you help me, please?

for example:
file.txt contain these rows:
andrew
thomas
eva

and when append a new row I get an e-mail/and sound alert.

Thanks in advance.

TB0ne 10-29-2016 12:01 PM

Quote:

Originally Posted by freeroute (Post 5624481)
I would like to send e-mail alert for me and play a sound when a text file changed (for example append one row into to file ). How can I do that? I guess bash programming, but I don't know how to do this. No GUI, only CLI interface.

OS: GNU/Debian
Could you help me, please?

for example:
file.txt contain these rows:
andrew
thomas
eva

and when append a new row I get an e-mail/and sound alert.

We will be glad to help you...so post what YOU have written/done/tried/researched and tell us where you're stuck. We aren't going to write scripts for you...read the "Question Guidelines" link in my posting signature. This is very similar to other threads you've posted where you ask a question, and show zero effort of your own.

As a hint, you need to look at the inotify command, or at the very least try putting "watch a file for changes in linux" into Google. The over 1.5 MILLION hits there can also get you started.

michaelk 10-29-2016 12:03 PM

You can write a bash script that uses inotify-tools i.e. inotifywait to monitor the file for changes and then perform some action.

https://github.com/rvoicilas/inotify-tools/wiki#info

freeroute 10-29-2016 06:49 PM

Thanks for your help.
I will try "notify-tools".


All times are GMT -5. The time now is 04:17 AM.