[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

fooling a non-"stdin redirection accepting" app (colortail)??



colortail is not a full replacement for tail - namely, it precludes pipe/|/stdin

systemd-journalctl -f gives a non colorized output.

Here's my failed attempt to fool colortail into accepting a bash file
descriptor in order to pipe journal through colortail:

Refer: http://www.tldp.org/LDP/abs/html/io-redirection.html

$ cd /tmp
$ sudo tail /var/log/syslog > t.txt
$ ll t.txt
4.0K -rw------- 1 1.4K 2012-11-24 18:45 t.txt

# Assign  file descriptor 3 to t.xt:
$ exec 3<> t.txt

# attempts to use this to trick colortail command:
$ colortail -f 3
colortail: Failed to open file: 3
# fail

$ colortail -f &3
[1] 27522
bash: 3: command not found
# fail; whoops, of course, & backgrounds prior command, so cleanup:
$ jobs
[1]+  Running                 colortail -f &
$ fg
colortail -f
^C$ jobs
$

$ colortail -f "&3"
colortail: Failed to open file: &3
==> &3 <==
#fail

$ colortail -f '&3'
colortail: Failed to open file: &3
==> &3 <==
#fail

# Tried all options I could think of, so give up and cleanup FD3:
$ exec 3>&-

========================
SO, it comes to my mind, that there ought be a way to turn a bash file
descriptor, into a file name, to fool colortail in some other way.
Perhaps a /proc/$PID/fd/... or some such.

So:
$ find /proc/|grep -i fd
# gives lots and lots of output that looks promising
$ sudo find /proc/|grep -i fd > t1
$ exec 3<> t.txt
$ sudo find /proc/|grep -i fd > t2
$ diff t1 t2
# this gives waay too much output

Anyone know where to next, in the search for ultimate control over
colortail, taming it into submission to the will of systemd-journald?

tia
zenaan

PS In addition to above, is there some other way to colorize journald's output?


Reply to: