I'm new to the list, hope this hasn't been covered before. I'm having some problems with syslog-ng, a named pipe and a shell script. I've created a destination in syslog-ng.conf that points to a pipe. In short the shell script looks like this. while read -r line; do sort input and output to file done < named.pipe Almost no matter what I do the script will sit outside the while loop not reading anything as things are input into the pipe. If i echo "anything" > named.pipe the shell script will run through all or most(not absolutly sure on this) of the input and then exit. I have this same setup on a FreeBSD computer and it works great, moved it to OpenBSD and it doesn't. If I do a tail -f on the pipe while my script is running then exit the tail the script works properly. I have tried a few different versions of syslog-ng and libol currently I have 1.6.0rc4 and 0.3.11. I have tried bourne, bash and ksh. Please help. Bobby Johnson Plexus Computer Services www.plexuscomp.com
On Mon, Nov 17, 2003 at 06:20:14PM -0700, Bobby Johnson wrote:
I'm new to the list, hope this hasn't been covered before. I'm having some problems with syslog-ng, a named pipe and a shell script. I've created a destination in syslog-ng.conf that points to a pipe. In short the shell script looks like this. while read -r line; do sort input and output to file done < named.pipe
Almost no matter what I do the script will sit outside the while loop not reading anything as things are input into the pipe. If i echo "anything"
named.pipe the shell script will run through all or most(not absolutly sure on this) of the input and then exit. I have this same setup on a FreeBSD computer and it works great, moved it to OpenBSD and it doesn't. If I do a tail -f on the pipe while my script is running then exit the tail the script works properly. I have tried a few different versions of syslog-ng and libol currently I have 1.6.0rc4 and 0.3.11. I have tried bourne, bash and ksh. Please help.
The script probably exits because of an EOF read from named.pipe, at least this is the case when you echo something into the named pipe. syslog-ng should never close the pipe though, so it should correctly send messages. Maybe you should try to strace|ktrace|truss the shell script to see what it exactly does. -- Bazsi PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
Thanks for the help, I did a ktrace. I noticed this in the trace. The trace file has nothing in it until I echo something to the pipe. 14319 bash CALL close(0x3) 14319 bash RET close 0 14319 bash CALL ioctl(0,TIOCGETA,0xcfbfd350) 14319 bash RET ioctl -1 errno 45 Operation not supported 14319 bash CALL lseek(0,0,0,0,0x1) 14319 bash RET lseek -1 errno 29 Illegal seek 14319 bash CALL read(0,0xcfbfd427,0x1) 14319 bash GIO fd 0 read 1 bytes "P" Bobby On Tue, 18 Nov 2003 10:08:39 +0100 Balazs Scheidler <bazsi@balabit.hu> wrote:
The script probably exits because of an EOF read from named.pipe, at least this is the case when you echo something into the named pipe.
syslog-ng should never close the pipe though, so it should correctly send messages. Maybe you should try to strace|ktrace|truss the shell script to see what it exactly does.
-- Bazsi PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
_______________________________________________ syslog-ng maillist - syslog-ng@lists.balabit.hu https://lists.balabit.hu/mailman/listinfo/syslog-ng Frequently asked questions at http://www.campin.net/syslog-ng/faq.html
On Tue, Nov 25, 2003 at 03:54:02PM -0700, Bobby Johnson wrote:
Thanks for the help, I did a ktrace. I noticed this in the trace. The trace file has nothing in it until I echo something to the pipe.
14319 bash CALL close(0x3) 14319 bash RET close 0 14319 bash CALL ioctl(0,TIOCGETA,0xcfbfd350) 14319 bash RET ioctl -1 errno 45 Operation not supported 14319 bash CALL lseek(0,0,0,0,0x1) 14319 bash RET lseek -1 errno 29 Illegal seek 14319 bash CALL read(0,0xcfbfd427,0x1) 14319 bash GIO fd 0 read 1 bytes
this shows that 1 byte was read on stdin, which is definitely not an EOF, the EOF is indicated by reading 0 bytes. -- Bazsi PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
participants (2)
-
Balazs Scheidler
-
Bobby Johnson