Blocked while Redirecting the syslog messages to a pipe in the rc script file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Blocked while Redirecting the syslog messages to a pipe in the rc script file
# 1  
Old 03-08-2011
Blocked while Redirecting the syslog messages to a pipe in the rc script file

Hi All,
I am newbie to linux and i am trying to re-direct the syslog messages to a pipe.
I have modified the syslog.conf file accordingly and have written an rc script to read from the pipe and put them to a file.

I was able to get the log messages to the file but my system is getting blocked in the rc script due to the "read" and i was not asked for the username and password for login.

This is my rc script is as follows

#!/bin/bash
cat /var/diagpipe | while read LINE
do
echo $LINE >> /var/Diag.log
done

syslog.conf

*.info |/var/diagpipe

My rc script is getting excecuted after the rc script for syslod is executed.

can someone please help me, so that with my rc script i will be reading the data from the pipe continuously and i should not block.

Don't know if stty solves my problem.

Thanks in Advance

Anil.
# 2  
Old 03-08-2011
System "rc" scripts are executed sequentially. If one stops (like this one) the system will not continue booting.

If you need the script to be a "rc" script, it should background the monitoring process (preferably inclusing some means to stop the process which can be executed from another "rc" script when the system shuts down).

As written I cannot see any advantage over just sending the syslog "info" log to a file rather than a pipe.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Writing a UNIX shell script to call a C function and redirecting data to a .txt file

Hi, I am complete new to C programming and shell scripting. I just wrote a simple C code to calculate integral using trapezoid rule. I am prompting user to pass me No. of equally spaced points , N , upper and lower limit. My code looks as follows so far: #include<stdio.h> #include<string.h>... (2 Replies)
Discussion started by: bjhjh
2 Replies

2. Shell Programming and Scripting

How to ignore Pipe in Pipe delimited file?

Hi guys, I need to know how i can ignore Pipe '|' if Pipe is coming as a column in Pipe delimited file for eg: file 1: xx|yy|"xyz|zzz"|zzz|12... using below awk command awk 'BEGIN {FS=OFS="|" } print $3 i would get xyz But i want as : xyz|zzz to consider as whole column... (13 Replies)
Discussion started by: rohit_shinez
13 Replies

3. Shell Programming and Scripting

Redirecting command output to a file in a shell script

Hello All, I have some unique requirement. I have written a very lengthy script which calls number of resource script to execute a particular task. What I want is output of each command(called from main script and resource scripts) should go to a... (3 Replies)
Discussion started by: anand.shah
3 Replies

4. UNIX for Dummies Questions & Answers

redirecting arguments in a script to multiple lines in a .txt file

Ok hope my vocab is right here, i'm trying to write multiple sets of arguments to another file for example: I have a script that accepts four arguments and sends them to a another file $write.sh it then out in so the file receiver.txt would contain this: it then out in what... (2 Replies)
Discussion started by: austing5
2 Replies

5. UNIX for Dummies Questions & Answers

redirecting the script output to more than 1 file

Hi, I want to redirect my script output to more than one file without printing the result to the screen. How to do that? ex: echo "hi" >> a.txt b.txt cat a.txt hi b.txt :confused: (2 Replies)
Discussion started by: boopathyvasagam
2 Replies

6. Shell Programming and Scripting

Redirecting STDERR to a file from within a bash script

I am trying to redirect the output from stderr to a log file from within a bash script. the script is to long to add 2> $logfile to the end of each command. I have been trying to do it with the command exec 2> $logfile This mostly works. Unfortunately, when a read command requires that anything be... (5 Replies)
Discussion started by: vockleya
5 Replies

7. UNIX for Dummies Questions & Answers

Need help with shell script for chekking a column in txt file - pipe delimited

Hi: I have a text file date(pipe delimited) which is loaded in to the DB using sql loader(&CTL files) after some initial validation by the shell script. Now i have a situation where the shell script needs to check a column in the text file and if it is NULL then it needs send this record/row... (12 Replies)
Discussion started by: ravi0435
12 Replies

8. Shell Programming and Scripting

Redirecting the warning messages.

I have written a Perl module. We know that we have to include the "-w" option in the first line as good programming practise. #! /usr/bin/perl -w Now when i use this,it gives me a number of warnings which are pretty much harmless as the code works perfectly fine without the -w option. Now... (1 Reply)
Discussion started by: keka
1 Replies

9. Programming

redirecting gcc messages

When I execute make, the gcc is echoing all the command lines to the console. How can I redirect these lines to a file? The same question for the @echo command. Thanks, rkt (3 Replies)
Discussion started by: rakkota
3 Replies

10. Shell Programming and Scripting

Need help capturing pipe to a file in shell script

The command: echo "this is some text" | shellscript abc def ghi My problem: How to capture "this is some text" so that I can process it, I.e. capture to a file. What I'm attemting to do is process the text echo'd into a file after writing the parameters passed first. No problem... (6 Replies)
Discussion started by: heinz
6 Replies
Login or Register to Ask a Question