LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-29-2016, 10:17 AM   #1
freeroute
Member
 
Registered: Jul 2016
Location: Hungary
Distribution: Debian
Posts: 69

Rep: Reputation: Disabled
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.

Last edited by freeroute; 10-29-2016 at 10:27 AM.
 
Old 10-29-2016, 12:01 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,813

Rep: Reputation: 8003Reputation: 8003Reputation: 8003Reputation: 8003Reputation: 8003Reputation: 8003Reputation: 8003Reputation: 8003Reputation: 8003Reputation: 8003Reputation: 8003
Quote:
Originally Posted by freeroute View Post
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.

Last edited by TB0ne; 10-29-2016 at 12:03 PM.
 
1 members found this post helpful.
Old 10-29-2016, 12:03 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,831

Rep: Reputation: 5969Reputation: 5969Reputation: 5969Reputation: 5969Reputation: 5969Reputation: 5969Reputation: 5969Reputation: 5969Reputation: 5969Reputation: 5969Reputation: 5969
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
 
1 members found this post helpful.
Old 10-29-2016, 06:49 PM   #4
freeroute
Member
 
Registered: Jul 2016
Location: Hungary
Distribution: Debian
Posts: 69

Original Poster
Rep: Reputation: Disabled
Thanks for your help.
I will try "notify-tools".
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to monitor the file size and send alert via email? thomas2004ch Linux - Software 2 10-25-2013 04:13 AM
script to send the swap is running out of requirement an alert to mail nallanisai Linux - General 1 07-16-2011 04:34 PM
Seek script to monitor sizes of list of files and send alert if size changes Jon_Roland Linux - Security 3 03-28-2011 04:37 PM
Check file size & if it is zero then send mail prateek_sahu Programming 1 08-04-2009 04:44 AM
send alert when new mail arrives disorderly Linux - General 2 11-09-2006 03:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration