Re: Cron Daemon backup message too big
- From: "Owen Townend" <owen.townend@xxxxxxxxx>
- Date: Mon, 31 Mar 2008 20:09:46 +1100
On 31/03/2008, Haines Brown <brownh@xxxxxxxxxxxxxxxx> wrote:
Someone kindly communicated to me privately, and I realized that I was
not being sufficiently complete regarding my problem.
In my backup script, I have the line:
find / -print | egrep -v "^/media|... " 2>&1 | cat -vt
What this command does is to concatenate stdout + errors and redirect
them to a terminal. This works fine when I call the command # backup.
However, when cron calls it, there's no terminal to which to send the
stdout, and so apparently it is redirected by default to a mail
message.
Could I avoid this by terminating the command line instead like this:
2>&1 /home/brownh/backup.log | cat -vt
Hey,
Almost right, though you need a redirect to the file too like so: `2>&1
1>/home/brownh/backup.log`. Note
the '1' for stdout is optional, if it is left off it is assumed. This
will send absolutely nothing through
to `cat`.
If passing through `cat` is necessary for formatting your output then use
something like this:
`2>&1 | cat -vt > /home/brownh/backup.log` This passes both stderr and
stdout through cat and then into the log file.
`2>&1` means literally send stderr to where stdout is going now.
The order matters here, if you use `2>&1 >/home/brownh/backup.log` then
stderr will be coming out to where stdout defaulted to (in this case
to cron's mail) and stdout will be going to the file. This could also be
desireable.
Also, with `cat -vt` the arg '-t' == '-vT' making your argument string
play out to '-vvT'. At a guess you are either after just '-t' or trying to
explicitly give '-vT'.
HTH,
cheers,
Owen.
Here I clobber the contents of backup.log, which is what I want. Is the
syntax right? Will it avoid sending stdout to a mail message?
My guess is that when I upgraded to etch, cron stdout was redirected by
default to a mail message. That's OK, except in this case it causes
exim4 to complain about the size of the message and terminate the find
command.
--
Haines Brown, KB1GRM
--
- Follow-Ups:
- Re: Cron Daemon backup message too big
- From: Haines Brown
- Re: Cron Daemon backup message too big
- References:
- Cron Daemon backup message too big
- From: Haines Brown
- Re: Cron Daemon backup message too big
- From: Andrei Popescu
- Re: Cron Daemon backup message too big
- From: Haines Brown
- Re: Cron Daemon backup message too big
- From: Haines Brown
- Cron Daemon backup message too big
- Prev by Date: Re: most lightweight debian server
- Next by Date: Re: most lightweight debian server
- Previous by thread: Re: Cron Daemon backup message too big
- Next by thread: Re: Cron Daemon backup message too big
- Index(es):
Relevant Pages
- Re: Cron Daemon backup message too big
... What this command does is to concatenate stdout + errors and redirect ...
Could I avoid this by terminating the command line instead like this: ... Will it avoid
sending stdout to a mail message? ... (Debian-User) - Re: last character of the last line is a newline?
... Would it be possible to redirect only to a file. ... output to standard output.
... # to stdout and to your_file ... Substitute your_program by the compound
command of your original posting: ... (comp.unix.shell) - Re: Start a program and get a hold of its STDOUT and STDIN?
... one would just redirect it on the command line: ... > was examples
of getting STDIN or STDOUT but not both at ... I need this to be in real time (when
the ... (comp.lang.perl.misc) - Re: Pipes and interprocess communication
... > command line argument) as a separate process. ... I redirect the
stdout, ... > I then redirect the stdout of my program from the command line:
... (microsoft.public.vc.language) - Re: Redirecting STDOUT
... output of stdout redirected to a file. ... impression the following would redirect
stdout to a file, ... This is highly shell dependent but on ksh, this command works.
... The above command will redirect stderr to the bit bucket and ... (freebsd-questions)