Sponsored Content
Top Forums Shell Programming and Scripting Pause for response from the log file Post 302249104 by gxdanh on Monday 20th of October 2008 03:44:54 PM
Old 10-20-2008
Pause for response from the log file

Hello,
I am writing a shell script to search an active log file. If an "error" or "aborted" found, echo an acknowledgment message and wait until the user presses ENTER key.

tail -f log.file |nawk '
{print $0}
$0 ~ /error/ {
print "Error found. Press ENTER to acknowledge."
getline i < "-"
}
$0 ~ /aborted/ {
print "Error found. Press ENTER to acknowledge."
getline i < "-"
}
'
Because this is an active log file, the messages keep coming to the log file all the time. The next incoming message, after error or aborted found, is read as response to the message.

I may have multiple Putty sessions running at same time. Only Putty session that displayed message can accept the response from user.

Thanks.
George
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to pause another process?

I guess I posted in wrong forum before. How do I pause another process and then restart it on linux? The other process doesn't listen for anything. Thanks for any help you can offer. Dane :confused: (1 Reply)
Discussion started by: daneensign
1 Replies

2. Programming

pause? where art thou?

ok, im somewhat of an advanced programmer for the windows-side of C/C++, and the system command to pause the console is 'system("pause");'.... i just recently transfered over to Slackware 3.3 (yes, its old, but i <3 text), and pause is not the command for pausing the command line. is there any... (3 Replies)
Discussion started by: 01000101
3 Replies

3. UNIX for Dummies Questions & Answers

pause() problems

well is gets stuck and i dont know why....... pid=fork(); if(pid==0) { pause(); write(1,"child",5); exit(0); } else { sleep(1); kill(pid,SIGCONT); write(1,"parent",5); wait(0); } all=1; (1 Reply)
Discussion started by: IdleProc
1 Replies

4. AIX

How to pause a while loop while reading from a file

Hi, I am building a script to grep for a string in all the files from a folder and display the results. I am reading the files one by one by placing the names in other file using while loop my code is as below while read inp do chk=`grep -c "$str" $pth/$inp` ... (2 Replies)
Discussion started by: sekhar gajjala
2 Replies

5. Shell Programming and Scripting

How to pause a shell script

Hi, I've written a shell script to take photos with my camera. After every picture taken, the picture is transmitted to the computer via usb and then deleted on the camera. But sometimes there's an error and the picture is not deleted and so, after a certain time, the camera chip will be... (4 Replies)
Discussion started by: McLennon
4 Replies

6. Shell Programming and Scripting

Calculate response time from log

I have a running log file (jboss_server.log) which rotates at midnight . I need to constantly check and calculate the time for each thread and alert if it doesnt complete within 60 minute. For example my log file has following printed . I want to run a script in cron every 30 minutes and... (2 Replies)
Discussion started by: gubbu
2 Replies

7. UNIX for Dummies Questions & Answers

Is it better/possible to pause the rsyncing of a very large directory?

Possibly a dumb question, but I'm deciding how I'm going to do this. I'm currently rsyncing a 25TB directory (with several layers of sub directories most of which have video files ranging from 500 megs to 4-5 gigs), from one NAS to another using rsync -av. By the time I need to act ~15TB should... (3 Replies)
Discussion started by: DeCoTwc
3 Replies

8. Shell Programming and Scripting

[Solved] Need Help in reading Response file

Hi All, I have a requirement to read response file which looks like below Ex: NAME=SAM DOB=01/01/1980 ADDRESS= 7658 James Street NewYork 0000 Now, I need to take NAME, DOB, ADDRESS into variables I am fine taking NAME and DOB I need help on how can I... (6 Replies)
Discussion started by: mallak
6 Replies

9. Shell Programming and Scripting

Pause before exit

6) printf "\n GoodBye! \n\n"; exit ;; I am trying modify the above command to pause a couple of seconds before exiting, so a message can be displayed. Thank you :). (8 Replies)
Discussion started by: cmccabe
8 Replies
eli(8)							      System Manager's Manual							    eli(8)

Name
       eli - error log initialization program

Syntax
       eli [ options ]

Description
       The command initializes error logging.  This command enables error logging of hardware and system-related error packets, or error messages,
       from the kernel errorlog buffer.  It can also disable error logging, reconfigure error logging parameters, or initialize the kernel  error-
       log buffer.

Options
       -d     Disables error logging.

       -e     Enables error logging in multiuser mode.

       -f     Forces the subsequent option; the system will not prompt.  This is the only command option you can use with another option.

       -h     Prints information about the command.

       -i     Initializes the kernel errorlog buffer.  The previous contents of the errorlog buffer are lost.

       -l     Logs a one-line status message to the kernel errorlog buffer.

       -n     Only supported for local error logging.  Disables logging error packets to disk by the daemon. High priority error messages continue
	      to be printed at the console.  Note that error log packets can be viewed by using the option in real time, but are never written	to
	      the disk.  For this reason, this option is rarely used.

       -q     Suppresses the periodic display, on the console, of the missed error message that results from a full kernel errorlog buffer.

       -r     Reconfigures error logging.  Use this option after changing the file.

       -s     Enables error logging in single-user mode.

       -w     Enables the missed error message to appear on the console every 15 minutes.  This option is the opposite of

Examples
       This example logs a one-line message into the errorlog file.
       eli -f -l "This is a test message"
       This example logs a message, up to and including the first new line, from the file
       eli -f -l < myfile > /dev/null

Restrictions
       You must have superuser privileges to use the command.

       Only the -f option can be used with other options.  You must use the syntax shown in the examples above.

Diagnostics
       eli: Request Aborted.
       The requested action was aborted.  The reason for the aborted command is included with the output.

Files
See Also
       elcsd.conf(5), elcsd(8), uerf(8)
       Guide to the Error Logger

																	    eli(8)
All times are GMT -4. The time now is 05:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy