Redirect STDOUT & STDERR to file and then on screen
Dear all,
redirecting STDOUT & STDERR to file is quite simple, I'm currently using:
Code:
But during script execution I would like the output come back again to screen, how to do that?
Thanks
Luc
Moderator's Comments:
edit by bakunin: please use CODE-tags like the ones i edited in for you. Thanl you.
How can I redirect and append stdout and stderr to a file when using cron? Here is my crontab file:
*/5 * * * * /dir/php /dir/process_fns.php >>& /dir/dump.txt
Cron gives me an 'unexpected character found in line' when trying to add my crontab file.
Regards,
Zach Curtis
POPULUS (8 Replies)
Hi all,
I need to redirect stdout and stderr to a file in a ksh shell. That's not a problem. But I need also the correct exit code for the executed command. In the example below I redirect correctly the stdout & stderr to a file, but I have the exit code of tee command and not for the mv... (2 Replies)
Friends
I have to redirect STDERR messages both to screen and also capture the same in a file.
2 > &1 | tee file works but it also displays the non error messages to file, while i only need error messages.
Can anyone help?? (10 Replies)
Hi friends
I am facing one problem while redirecting the out of the stderr and stdout to a file
let example my problem with a simple example
I have a file (say test.sh)in which i run 2 command in the background
ps -ef &
ls &
and now i am run this file and redirect the output to a file... (8 Replies)
Hi
I am not if this is possible: is it possible in bach (or another shell) to redirect GLOBALLY the stdout/stderr channels to a file.
So, if I have a script
script.sh
cmd1
cmd2
cmd3
I want all stdout/stderr goes to a file. I know I can do:
./script.sh 1>file 2>&1
OR
... (2 Replies)
EDIT: Nevermind, figured it out! Forgot to put backslashes in my perl script to not process literals!
Hi everyone. I am trying to have this command pass silently. (no output)
chsh -s /bin/sh news
Currently it outputs.
I've tried....
&> /dev/null
1> /dev/null
2>&1 /dev/null
1>&2... (1 Reply)
Hello
I read a lot of post related to this topic, but nothing helped me. :mad:
I'm running a ksh script with subshell what processing some ldap command. I need to check output for possible errors.
#!/bin/ksh
...
readinput < $QCHAT_INPUT |&
while read -p line
do
echo $line
... (3 Replies)
Currently I am redirecting STDERR and STDOUT to a log file by doing the following
{
My KSH script contents
} 2>&1 | $DEBUGLOG
Problem is the STDERR & STDOUT do not have any date/time associated.
I want this to be something that i can embed into a script opposed to an argument I use... (4 Replies)
Dear all,
redirecting STDOUT & STDERR to file is quite simple, I'm currently using:
exec 1>>/tmp/tmp.log; exec 2>>/tmp/tmp.logBut during script execution I would like the output come back again to screen, how to do that?
Thanks
Lucas (4 Replies)
I have to redirect STDERR messages both to screen and also capture the same in a file but STDOUT only to the same file.
I have searched in this formum for a solution, but something like
srcipt 3>&1 >&2 2>&3 3>&- | tee errs
doesn't work for me...
Has anyone an idea??? (18 Replies)
Discussion started by: thuranga
18 Replies
LEARN ABOUT OSF1
log
log(8) System Manager's Manual log(8)NAME
log - Records input and output from a program
SYNOPSIS
/usr/sbin/log <logfile> <command>
OPERANDS
The file in which to record the interaction being logged. The command to execute.
DESCRIPTION
The log program runs <command> and logs the input to and output from <command> to the <logfile> file. Input and output are logged until
<command> exits, the log program exits, and the exit status of <command> is returned.
The log program is used by the system installation procedure and the it(8) command to create the /var/adm/smlogs/install.log and
/var/adm/smlogs/it.log installation log files.
RESTRICTIONS
Because the log program is used in the installation standalone environment, program size was the greatest concern in its implementation.
The log program does not search for the PATH variable to locate <command> and error messages are terse.
The log program causes <command> to take standard input from and write standard output and standard error to UNIX pipes. Some commands
will not be able to operate in this environment; therefore, it is suggested that you use the script(1) command instead. UNIX shells will
not issue prompts when run from log unless the shell is started with an explicit interactive switch (-i for most shells). For example, log
foo.tmp /sbin/sh -i
In the previous example, foo.tmp is the name of <logfile>.
The log program intercepts end-of-file (usually Ctrl/d). Therefore programs which normally receive end-of-file as an exit command must
exit by some other means.
ERRORS
Log open error
Explanation:
The log program was unable to open <logfile>. Verify that the directory exists and that ownerships and permissions are set correctly.
Exec Error
Explanation:
The log program was unable to execute <command>. Verify that you specified a full pathname for <command> and that <command> is an exe-
cutable file.
Fork Error
Explanation:
The log program was unable to create one of the processes it requires to log data.
SEE ALSO
Commands: it(8), script(1)log(8)