Event logging to file and display to console | tee command is not able to log all info.
My intention is to log the output to a file as well as it should be displayed on the console > I have used tee ( tee -a ${filename} ) command for this purpose. This is working as expected for first few outputs, after some event loggin nothing is gettting logged in to the file but It is displaying on the console.
I can elaborate this.
Dashed line indicate the operation performing (code). Here in this example first two statements are displaying and logging into log file. But from third statement onwards nothing is getting logged in to the file, but is is displaying on the console. Is this because the command execution speed is more, execution is very quick.?
Thanks,
Sanoop
Last edited by Franklin52; 02-24-2012 at 03:46 AM..
Reason: Please use code tags for code and data samples, thank you
It sunds more like a quoting imbalance, where the te got hidden.
I usually go for the quieter:
The there is the ever favorite no tee, just log to file, and to watch:
Sometimes long commands, even sub-shells and scripts, will buffer, stopping mid-line, but usually at each command end the log catches up.
Programmers can help by either calling flush() periodically to clean FILE* buffers, or initially calling setvbuf() to configure line buffering. I used to use setvbuf for a huge buffer, and flush to write whole log blocks in one piece, because I had many servers writing the same logs.
I think that we need to see lines 3+ .
My blind guess for the hidden code is that it starts another Shell.
Ps. It always helps to post what Operaing System and version you have and what Shell you are using.
The "echo -e" says some sort of Sunos to me, but there is very liitle actual Shell in the post.
For instance, if some line does something this, stdin and stdout are changed, no longer default to the display:
(A bad practice, in my view, as it confuses readers of subsequent lines. If you want to redirect for a while, put that bit in () or {} and redirect just that bit, temporarily.)
When unlocking a Linux server's console there's no event indicating successful logging
Is there a way I can fix this ?
I have the following in my rsyslog.conf
auth.info /var/log/secure
authpriv.info /var/log/secure (1 Reply)
Hi,
I've the following code to log the errors any after the command is executed.
# Ksh 88 Version
log_path=/home/etc/fls/fls_log.log
del_path=/home/etc/fls/to_day
rm $del_path/* >> $log_path 2>&1
But I even want to log if the rm command is success without any error along with... (1 Reply)
Hi,
I'd like to redirect the STDOUT output from my script to a file and simultaneously display it at a console.
I've tried this command:
myscript.sh | tail -f
However, it doesn't end after the script finishes running
I've also tried this:
myscript.sh | tee ~/results.txt
But it writes... (3 Replies)
How do I know what parts of the application to monitor and what means do I use to get this data? Can I use proc? What interactions are important and how do I view them?I would be more descriptive but I have not a clue.
Thanks in... (18 Replies)
Hello,
I start an adapter using the following command -
nohup ./start_embargoAdapter >/dev/null 2>&1 &
and when I do the following, I can see:
/export/home/xxxxx> ps -ef | grep embargo
xxxxx 28086 20761 0 23:23:29 pts/7 0:00 grep embargo
xxxxx 8866 1 0 Oct 06 ? 0:00... (2 Replies)
Hi,
When I run the following command in terminal it works. The string TEST is appended to a file silently.
echo TEST | tee -a file.txt &>/dev/null
However, when I paste this same line to a file, say shell1.sh, and use bourne shell .
I run this file in terminal, ./shell1.sh.
However I... (1 Reply)
I'm not a complete novice at unix but I'm not all that advanced either. I'm hoping that someone with a little more knowledge than myself has the answer I'm looking for.
I'm writing a wrapper script that will be passed user commands from the cron...
Ex:
./mywrapper.sh "/usr/bin/ps -ef |... (1 Reply)
Hi folks,
Please advise which command/command line shall I run;
1) to display the command and its output on console
2) simultaneous to save the command and its output on a file
I tried tee command as follows;
$ ps aux | grep mysql | tee /path/to/output.txt
It displayed the... (7 Replies)
Hi,
The output of the cat ttys on a free BSD m/c
console none unknown off secure
#
# Serial terminals
# The 'dialup' keyword identifies dialin lines to login, fingerd etc.
ttyd0 "/usr/libexec/getty std.9600" unknown on secure
ttyd1 "/usr/libexec/getty std.9600" dialup off
ttyd2... (0 Replies)
Hi all,
Well I've had a bit more experience with Unix-like environments since my last post, now that I have started working on my website in earnest and am doing much of the file manipulation via the command line through SSH.
The thing is, I want to be able to log all console activity,... (4 Replies)