Home > Linux > How create and use pipes in Linux

How create and use pipes in Linux

Create a named pipe using mkfifo: mkfifo -p /var/adm/syslog.pipe

Make syslog.conf to points to this file (for example /var/adm/syslog.pipe)

*.info                        |/var/adm/syslog.pipe

Relaunch syslogd:
  kill -HUP `cat /var/run/syslogd.pid`

Create processing script that read the pipe. It should run constantly and be launched from RC scripts

#!/bin/ksh
cat /var/adm/syslog.pipe | grep -v “denied update from” | while read LINE
do
  echo $LINE >>/var/adm/denied_update.log

Categories: Linux Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

%d bloggers like this: