01-09-2008
A UNIX process has not one but *two* outputs by default: <stdout> and <stderr>
To capture them in a file you have to use two output redirections accordingly:
command 1> /some/file or
command > /some/file
will only redirect the file descriptor 1 (which is <stdout>). <stderr> will not be redirected and hence go to the default I/O device, in this case the screen of the terminal. To redirect the output on <stderr> too, issue:
command 1> /some/logfile 2>/some/errorfile
This will send the output to <stdout> to /some/logfile and the output to <stderr> to /some/errorfile. The same is true for cron (which is just another means to start processes) jobs. Probably you just haven't redirected the <stderr> output channel.
BEWARE:
Usually redirection is done in this casual way:
command >/path/to/logfile 2>&1
"2>&1" means: redirect file descriptor 2 ( = <stderr>) to where file descriptor 1 (<stdout>) points right now. The problem is, that these two file descriptors are still not the same and redirecting FD1 to somewhere else doesn't mean FD 2 will change too. A common pitfall is:
command 2>&1 >/path/to/logfile
which will first redirect FD 2 to where FD 1 points (perhaps the screen), then redirect FD 1 to a file. Most likely the intention was not this, but to redirect both to the same file, which would be achieved by the first example. To avoid any ambiguities better write it down this way, which doesn't depend on the order of the parts:
command 1>/path/to/logfile 2>/path/to/logfile
Hope this helps.
bakunin
10 More Discussions You Might Find Interesting
1. AIX
We are currently using AIX sysback for our backups and I have a script that kicks off the backups daily. We just had the problem with the tape filling up and hanging the script. I want to add a test to my script to listen for the End of Tape error or tape full error. I can't find any information... (0 Replies)
Discussion started by: daveisme
0 Replies
2. AIX
I've set sysback to run in the cron daily to backup my servers to a nim servers SAN storage. Every once and a while the backup process hangs and the backup doesn't complete. When I check the processes the sysback processes are still running hours after sysback would normally end. I don't see any... (1 Reply)
Discussion started by: daveisme
1 Replies
3. AIX
In smitty sysback I see there is are Offline Mirror backup and Snap Shot backup options and want to know how to use these backups without TSM. Or does anybody know where I can find information on setting up and preforming these type of backups and restores from the backups? (0 Replies)
Discussion started by: daveisme
0 Replies
4. Solaris
I have tried to compile the code on solaris which is
bash-3.00$ uname -a
SunOS zen 5.7 Generic_106541-37 sun4u sparc SUNW,Ultra-80
bash-3.00$ CC -V
CC: WorkShop Compilers 5.0 98/12/15 C++ 5.0
when I compile just a simple program,
int main()
{
long kk = 200;
int jj = kk;
return... (0 Replies)
Discussion started by: amit_27
0 Replies
5. AIX
Dear experts,
please help in this regard,
when i am trying to compile some files for 64 bit in AIX, iam getting this warning
"/usr/include/alloca.h", line 34.9: 1540-1401 (I) An unknown "pragma __alloca" is specified.
how to solve this warning , what is the significance of this please... (1 Reply)
Discussion started by: vin_pll
1 Replies
6. Emergency UNIX and Linux Support
I am trying to install the Sysback client (TSM for System Backup and Recovery) 6.1 on an LPAR running AIX 5.3. One of the filesets is failing to install. Here's what it says in the preview:
FAILURES:
tivoli.tsm.client.api.32bit 5.5.1.0 # TSM Client - Application Pro...
MISSING... (2 Replies)
Discussion started by: need2bageek
2 Replies
7. AIX
Is there a flag to send to sysback on the command line so it will return the estimated backup size and exit?
We're having issues with running to a second tape at a remote data center, and I want to alter the script to exit or add exclusions if the backup is over a certain size.
The other... (0 Replies)
Discussion started by: tommysalami
0 Replies
8. Shell Programming and Scripting
Hi Guys,
I am working on a shell script(main script) where in i have to call another script B and pass parameter to that script. I see that the shell script that is being called in the main script is throwing warnings/fatal errors. So i am just wondering how do i capture these and ask the script... (1 Reply)
Discussion started by: stunnerz_84
1 Replies
9. AIX
HELLO ALL
i have installed aix 6.2 , and install sysback 6.1 over Nim , and cinfigure it by Nim AND sysback smitty menu with create spot and lppsource and make TSM configration for that, i take image backup(installation image) successfully but when i want to restore this image , the boot cycle... (5 Replies)
Discussion started by: nancy_ghawanmeh
5 Replies
10. AIX
We used sysback to backup some older servers and now need to restore some of the directories within a file system. I've tried to use smitty sysback to list the content of the file system but there are over 3000 entries. I'm looking for a command that would allow me to list out the directories to... (2 Replies)
Discussion started by: daveisme
2 Replies
LEARN ABOUT LINUX
bootlogd
BOOTLOGD(8) Linux System Administrator's Manual BOOTLOGD(8)
NAME
bootlogd - record boot messages
SYNOPSIS
/sbin/bootlogd [-c] [-d] [-r] [-s] [-v] [ -l logfile ] [ -p pidfile ]
DESCRIPTION
Bootlogd runs in the background and copies all strings sent to the /dev/console device to a logfile. If the logfile is not accessible, the
messages will be kept in memory until it is.
OPTIONS
-d Do not fork and run in the background.
-c Attempt to write to the logfile even if it does not yet exist. Without this option, bootlogd will wait for the logfile to appear
before attempting to write to it. This behavior prevents bootlogd from creating logfiles under mount points.
-r If there is an existing logfile called logfile rename it to logfile~ unless logfile~ already exists.
-s Ensure that the data is written to the file after each line by calling fdatasync(3). This will slow down a fsck(8) process running
in parallel.
-v Show version.
-l logfile
Log to this logfile. The default is /var/log/boot.
-p pidfile
Put process-id in this file. The default is no pidfile.
BUGS
Bootlogd works by redirecting the console output from the console device. (Consequently bootlogd requires PTY support in the kernel con-
figuration.) It copies that output to the real console device and to a log file. There is no standard way of ascertaining the real con-
sole device if you have a new-style /dev/console device (major 5, minor 1) so bootlogd parses the kernel command line looking for con-
sole=... lines and deduces the real console device from that. If that syntax is ever changed by the kernel, or a console type is used that
bootlogd does not know about then bootlogd will not work.
AUTHOR
Miquel van Smoorenburg, miquels@cistron.nl
SEE ALSO
dmesg(8),fdatasync(3).
Jul 21, 2003 BOOTLOGD(8)