Re: mail redirection using batch command

From: Bill Rhode (Bill.Rhode@SUNGARD.COM)
Date: Mon Jan 05 2004 - 10:23:35 EST


Bill, thank you for the response. Your batch example also failed in that it
was still writing to the mailbox. You did put me on to a different thought
track though and I realized (finally) that the /usr/bin/batch script was
executing "at" with the -m parameter, telling it to write to mailbox. My
solution seems to be to edit /usr/bin/batch or to make a login specific
version that is put higher in $PATH. Thanks again.
----- Forwarded by Bill Rhode/SunGardEBS on 01/05/2004 09:10 AM -----

                      "Bill Thompson"
                      <wht@neo.rr.com> To: "IBM AIX Discussion List" <aix-l@Princeton.EDU>
                                               cc: <Bill.Rhode@SUNGARD.COM>
                      01/02/2004 07:16 Subject: Re: mail redirection using batch command
                      PM

Bill,

The mailbox entry comes from the batch command, not from the "xx" command.
I
normally use "at now" rather than "batch", but they should work the same.
Try this:

batch >/dev/null 2>&1 <<!!
xx 1>>nohup1 2>>nohup2
!!

The file "nohup1" was empty because the command "xx" did not write anything
to STDOUT. If you use a real command such as "ls" (rather than "xx") the
output will go to nohup1.

HTH

Bill Thompson
Sr UNIX Systems Administrator
The Goodyear Tire & Rubber Co.

Contains Confidential and/or Proprietary Information
May Not Be Copied or Disseminated Without Express Consent of The Goodyear
Tire & Rubber Company.

AIX-L Archives: http://marc.theaimsgroup.com/?l=aix-l&r=1&w=2

----- Original Message -----
From: "Bill Rhode" <Bill.Rhode@SUNGARD.COM>
Newsgroups: bit.listserv.aix-l
To: <aix-l@Princeton.EDU>
Sent: Friday, January 02, 2004 5:47 PM
Subject: mail redirection using batch command

> I am having unexpected results on AIX 5.2 using the batch command as
demo'd
> in this "test" script.../
> batch <<!!
> xx 1>> nohup1 2>> nohup2
> !!
>
> My object is to route stderr and stdout to a disk file instead of to the
> user mailbox. It routes to both however. In the example, the nohup2 file
> contains the message "ksh[4]: xx: not found.". The mailbox output and
> relevent "man at" paragraph are below. Grateful for any input.
>
> MAILBOX ENTRY...
> Received: (from username@localhost) by aixdev2.company.com (AIX5.2/8.11.0
> /8.1
> 1.0) id i02M6Xq18438 for username; Fri, 2 Jan 2004 16:06:33 -0600
> Date: Fri, 2 Jan 2004 16:06:33 -0600
> From: username
> Message-Id: <200401022206.i02M6Xq18438@aixdev2.company.com>
> To: username
>
> cron: Job username.1073081193.b was run.
>
> MAN ENTRY...
> The at command mails you all output from standard output and standard
error
> for
> the scheduled commands, unless you redirect that output. It also writes
the
> job
> number and the scheduled time to standard error.

Copyright © 2003 by SunGard Data Systems Inc. (or its subsidiaries,
''SunGard''). All rights reserved. No parts of this document may be
reproduced or transmitted without SunGard’s prior written permission.

This document contains SunGard's confidential or proprietary information.
By accepting this document, you agree that: (A)(1) if a pre-existing
contract containing disclosure and use restrictions exists between your
company and SunGard, you and your company will use this information subject
to the terms of the pre-existing contract; or (2) if no such pre-existing
contract exists, you and your Company agree to protect this information and
not reproduce or disclose the information in any way; and (B) SunGard makes
no warranties, express or implied, in this document, and SunGard shall not
be liable for damages of any kind arising out of use of this document.



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:17:27 EDT