LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-18-2013, 10:02 PM   #1
Southpaw94
LQ Newbie
 
Registered: Feb 2009
Posts: 7

Rep: Reputation: 0
Arrow Use "Tail -f" with log file to sound error on predefined messages


Is it at all possible to trigger a sound event from ssh? I would think if grep could be used in junction tail -f, but I'm not sure how to trigger a sound event in a linux environment using such. The client computer on which I would want the event to sound/display runs Puppy Linux, and is to ssh into a server machine, running Ubuntu 12.10 amd64.

My experience is limited, but I'm willing to learn. I basically have no experience in creating script files like .sh to automate tasks.

Thank you.
Geoffrey
 
Old 06-19-2013, 01:43 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Unless wheel re-inventing is the name of the game I suggest you search your distros repos and Freecode, Sourceforge, Savannah.nongnu because I'm pretty sure something like that, or at least a tail implementation that runs external applications, has been cobbled up before. BASH code could look something like
Code:
_doSignal() { env DISPLAY=":0.0" /path/to/binary /path/to/soundfile &
}
tailf /some/path/to/logfile | while read ITEM; do
 [ if condition match ] && _doSignal
done
...and since you're interested in learning shell you also want these:

BASH intros:
http://www.gnu.org/software/bash/man...ode/index.html
http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
http://www.tldp.org/LDP/Bash-Beginne...tml/index.html

BASH scripting guides:
http://mywiki.wooledge.org/BashGuide
http://mywiki.wooledge.org/BashFAQ
http://mywiki.wooledge.org/BashPitfalls
# these are must reads so do read them!

Common questions / problems:
http://mywiki.wooledge.org/ParsingLs
http://mywiki.wooledge.orgDontReadLinesWithFor
http://mywiki.wooledge.org/UsingFind
http://mywiki.wooledge.org/Arguments
http://mywiki.wooledge.org/WordSplitting
http://mywiki.wooledge.org/Quotes

The Advanced BASH scripting guide:
http://www.tldp.org/LDP/abs/html/

Bourne shell (compatibility):
http://www.grymoire.com/Unix/Sh.html

Also see:
http://www.linuxquestions.org/questi...l-links-35334/
http://www.linuxquestions.org/questi...nd-line-32893/
http://www.linuxquestions.org/questi...ks-4175433508/
 
1 members found this post helpful.
Old 06-20-2013, 11:55 AM   #3
Southpaw94
LQ Newbie
 
Registered: Feb 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Awww, but re-inventing the wheel is so much fun...

But really, thank you. That actually helps out a lot. Definitely saving this.
 
  


Reply

Tags
error message, grep, sound, ssh, tail



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
Errors in /var/log/messages "error: Missing or invalid IP4 prefix '0'" kimurayuki Linux - Networking 5 12-06-2012 01:17 PM
[SOLVED] Tail the message log| grep " several words" play a sound when it's found. Alan87i Programming 17 07-08-2011 06:13 AM
How to make newer "tail" behave like older "tail" rylan76 Linux - Software 4 12-07-2007 04:27 AM
What does "SFW2-INext-DROP-DEFLT" in my messages log file mean? TrulyTessa Linux - Networking 11 12-22-2004 09:28 AM
Boot messages not the same as "dmesg" or "/var/log/messages"? massai Linux - General 5 03-10-2004 12:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:59 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