RE: crontab and exec

RE: crontab and exec

 

  

Joel

If you haven't done so already, you might confirm that replacing
${file} with an actual file name displays the same symptom. Maybe even
remove the single quote from the final echo.

I ran

#!/usr/bin/ksh
#tmw
echo "Here I go " >> /tmp/file.lis1
exec 1>/tmp/file.lis2 2>&1
echo "utilizing exec"
echo "Here I don't go " >> /tmp/file.lis1

from HP-UX cron and it worked according to Hoyle. 2 lines in .lis1 and
the one in .lis2. Same result with #!/usr/bin/sh.

Do you capture the cron output thusly?:
32 07 * * 5 /home/dba/bin/tmwtest >/tmp/tmwtest.cron 2>&1

Unlikely, but ...
Do you know that your online shell is the same as the one which cron
uses?
If your linux has a non-bash shell, maybe you could try that?

Trevor




-----Original Message-----
From: Patterson Joel
[mailto:oracledba-ezmlmshield-x70898580.[Email address protected]
Sent: Friday, 30 December 2005 5:27 AM
To: LazyDBA Discussion
Subject: RE: crontab and exec

I can echo, echo, and it will go to the file as follows:

Echo "Here I go " >> /u01/file.lis

Then,
Exec 1>${file} 2>&1

Echo "Here I don't go " >> /u01/file.lis

It is as simple as that. I even sourced echo...
ECHO=/bin/echo

$ECHO "Here I don't go " >> /u01/file.lis

This only doesn't work when executing the script from cron.



-----Original Message-----
From: Chris Hagemaier
[mailto:oracledba-ezmlmshield-x72175287.[Email address protected]
Sent: Thursday, December 29, 2005 3:59 PM
To: LazyDBA Discussion
Subject: RE: crontab and exec

Joel-
Is ${file} part of your environment or to you pass it to the script?
Just a thought but consider that cron jobs execute without an
environment. For example $PATH doesn't exist.

-----Original Message-----
From: Patterson Joel
[mailto:oracledba-ezmlmshield-x30363202.[Email address protected]
Sent: Thursday, December 29, 2005 12:51 PM
To: LazyDBA Discussion
Subject: crontab and exec




I'm having a heck of a time with cron on WBEL (linux). (sysadmin being
twirp) -- teaching me sysadmin by letting me figure it out myself, (ie
lazy)... except I don't want to be a sysadmin... nuf of that).

1) Some of you may recall my "exec 1>${file} 1>&2" line of code I use
in my scripts... I am attempting to solve my original riddle (which I
won't go into here), by running my script now via cron. What used to
work does not seem to correctly, at least on this box.

I cannot get any statement after the 'exec' to echo anywhere IF the
script is called from cron. (It works otherwise).

-------------------

2) ALSO. cron is runnig on EST, and my 'date' displays GMT... (I want
cron to run on GMT time as well.

More /etc/sysconfig/clock
ZONE="Europe/London"
UTC=true
ARC=false

Other server have different settings. Where do I go from here?
Something is missing as 'normal' sysadmins have already set up such
things for me and my scripts 'normally' work.


Thanks


--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com To unsubscribe:
see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com By using this list you agree
to these terms:http://www.lazydba.com/legal.html



--
This message has been scanned for viruses and dangerous content by
MailScanner, and is believed to be clean.

Douglas County, Oregon
www.co.douglas.or.us



--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com
To unsubscribe: see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com
By using this list you agree to these
terms:http://www.lazydba.com/legal.html




--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com
To unsubscribe: see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com
By using this list you agree to these
terms:http://www.lazydba.com/legal.html



DISCLAIMER:
Disclaimer. This e-mail is private and confidential. If you are not the intended recipient, please advise us by return e-mail immediately, and delete the e-mail and any attachments without using or disclosing the contents in any way. The views expressed in this e-mail are those of the author, and do not represent those of this company unless this is clearly indicated. You should scan this e-mail and any attachments for viruses. This company accepts no liability for any direct or indirect damage or loss resulting from the use of any attachments to this e-mail.

Oracle LazyDBA home page