11-15-2009
Quote:
Originally Posted by
Scrutinizer
To redirect stderr (2) to whatever stdin (1) is pointing to (the two output streams get to be blended).
A small correction, it is stdout ( 1 ) -- Not stdin.
So, To redirect stderr to stdout.
10 More Discussions You Might Find Interesting
1. Solaris
Does any one knows a work around for the crontab bug when connecting using ssh to a Solaris 8 system?
When you submit a crontab job through a ssh session, the job will not be executed, SunSolve has reported no fixing patches? (3 Replies)
Discussion started by: Negm
3 Replies
2. Shell Programming and Scripting
Can any body kindly tell me what is the purpose of 2>&1 in the following commands.
nohup ./append_import.sh 1 > import1.out 2>&1 < /dev/null &
nohup ./append_import.sh 2 > import2.out 2>&1 < /dev/null & (1 Reply)
Discussion started by: mmunir
1 Replies
3. UNIX for Dummies Questions & Answers
Hi there,
I'm using crontab to move some files every minute, but when crontab doesn't find these files it sends a message to the file "user_name" in the directory "var/spool/mail". Is it possible to "bypass" this problem?
Thanks in advance,
Giordano Bruno (1 Reply)
Discussion started by: Giordano Bruno
1 Replies
4. Fedora
Hi there,
I'm working with two servers, one with FEDORA 6 and the other one with FEDORA 7, and if I put these lines in crontab:
MAILTO=MYADDRESS@mail.com
*/1 * * * * df -h
everything works fine on FEDORA 7 , while it doesn't work on6?!?...and I find this message in the log file:
MAIL... (2 Replies)
Discussion started by: Giordano Bruno
2 Replies
5. Solaris
I have two ethernet interfaces nge0 and nge1.
An IP assigned on nge0 is 10.10.10.1/24 and on nge1 is 20.20.20.1/24. I want to make nge0 as primary interface.
My question here is,
1. Being nge0 as primary interface, if I ping to an IP 20.20.20.5, what will happen?
2. If the answer for the... (4 Replies)
Discussion started by: nthiruvenkatam
4 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I have read from the book that , <> causes the file to be used as both input as well as output. Can anyone give me the scenario where <> will be useful?
Thanks (10 Replies)
Discussion started by: pandeesh
10 Replies
7. Solaris
Hi Experts,
I would like to know, what does "2>&1" do in crontab?
example:
* * * * * /export/user/home/test.sh >> /export/user/home/logtest.log 2>&1
My colleague told me the commabd 2>&1 mean to prevent crontab sending an email (sendmail on /var/mail/root) when the script failed. So, if... (5 Replies)
Discussion started by: edydsuranta
5 Replies
8. Solaris
Hello Guru's
I'm trying to take the output of solaris top command and output to a txt file every few minutes. The issue that I'm experiencing is that I can run the following:
#!/bin/bash
#
logfile="/usr/mvf/morris/top.log"
# echo... (2 Replies)
Discussion started by: littlemorris
2 Replies
9. UNIX for Dummies Questions & Answers
HI,
I am using centos 6 and finding difficultly in doing 2 below things.
1. i have a user praveen i want to allow him to create cron job of his own. so i have added his user id in cron.allow but still it is not allowing him to edit(even if i have created praveen from root user) or create his... (4 Replies)
Discussion started by: praveenkumar198
4 Replies
10. Shell Programming and Scripting
I have a script that emails me when I run it manually, but the crontab I'm using must be 'silencing' the output? Here's what I have:
*/15 * * * * /usr/src/blah.sh > /dev/null 2>&1
I don't want it to email me every time it runs, just when I run the sendmail command inside the script if the... (13 Replies)
Discussion started by: unclecameron
13 Replies
STDIN(3) Linux Programmer's Manual STDIN(3)
NAME
stdin, stdout, stderr - standard I/O streams
SYNOPSIS
#include <stdio.h>
extern FILE *stdin;
extern FILE *stdout;
extern FILE *stderr;
DESCRIPTION
Under normal circumstances every Unix program has three streams opened for it when it starts up, one for input, one for output, and one for
printing diagnostic or error messages. These are typically attached to the user's terminal (see tty(4) but might instead refer to files or
other devices, depending on what the parent process chose to set up. (See also the "Redirection" section of sh(1).)
The input stream is referred to as "standard input"; the output stream is referred to as "standard output"; and the error stream is
referred to as "standard error". These terms are abbreviated to form the symbols used to refer to these files, namely stdin, stdout, and
stderr.
Each of these symbols is a stdio(3) macro of type pointer to FILE, and can be used with functions like fprintf(3) or fread(3).
Since FILEs are a buffering wrapper around Unix file descriptors, the same underlying files may also be accessed using the raw Unix file
interface, that is, the functions like read(2) and lseek(2).
On program startup, the integer file descriptors associated with the streams stdin, stdout, and stderr are 0, 1, and 2, respectively. The
preprocessor symbols STDIN_FILENO, STDOUT_FILENO, and STDERR_FILENO are defined with these values in <unistd.h>. (Applying freopen(3) to
one of these streams can change the file descriptor number associated with the stream.)
Note that mixing use of FILEs and raw file descriptors can produce unexpected results and should generally be avoided. (For the masochis-
tic among you: POSIX.1, section 8.2.3, describes in detail how this interaction is supposed to work.) A general rule is that file descrip-
tors are handled in the kernel, while stdio is just a library. This means for example, that after an exec(3), the child inherits all open
file descriptors, but all old streams have become inaccessible.
Since the symbols stdin, stdout, and stderr are specified to be macros, assigning to them is nonportable. The standard streams can be made
to refer to different files with help of the library function freopen(3), specially introduced to make it possible to reassign stdin, std-
out, and stderr. The standard streams are closed by a call to exit(3) and by normal program termination.
CONFORMING TO
The stdin, stdout, and stderr macros conform to C89 and this standard also stipulates that these three streams shall be open at program
startup.
NOTES
The stream stderr is unbuffered. The stream stdout is line-buffered when it points to a terminal. Partial lines will not appear until
fflush(3) or exit(3) is called, or a newline is printed. This can produce unexpected results, especially with debugging output. The
buffering mode of the standard streams (or any other stream) can be changed using the setbuf(3) or setvbuf(3) call. Note that in case
stdin is associated with a terminal, there may also be input buffering in the terminal driver, entirely unrelated to stdio buffering.
(Indeed, normally terminal input is line buffered in the kernel.) This kernel input handling can be modified using calls like tcse-
tattr(3); see also stty(1), and termios(3).
SEE ALSO
csh(1), sh(1), open(2), fopen(3), stdio(3)
COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2008-07-14 STDIN(3)