cron problem
m.roth2006 at rcn.com
m.roth2006 at rcn.com
Fri Apr 6 16:15:53 UTC 2007
Barry,
>Date: Fri, 6 Apr 2007 10:41:33 -0500 (CDT)
>From: Barry Brimer <lists at brimer.org>
>
>On Fri, 6 Apr 2007 m.roth2006 at rcn.com wrote:
>
>> Ok, folks, I'm going nuts. I've set up a cron job to run a script to back up Oracle. In the crontab entry, I've got it piping stdout and stderr to append to a logfile. It runs late every Thursday night.
>>
>> Well, allegedly.
>>
>> I find entries in /var/log/cron saying it ran... but there's no backup, and no log. Just this week, I added set -x in the script.
>>
>> Nada.
>>
>> Any suggestions? Oh, and yes, if I run it manually, it works just fine. The no output log *really* drives me nuts....
>
>Any chance that this script is relying on environment variables that are
>available in your current session, but would not be in the cron execution?
>Are you sourcing any needed environment in the script? Is there anything
>in the email that cron sends to the user who owns the cron job that would
>give more information?
Setting all the ORACLE* in the script. When I run it manually as Oracle, it's fine, even if I haven't source oraenv. It's running as Oracle's cron job, and...
<mark gets irritated, and finally install mutt on the box - all that had been on was mail ("a friendly, comformable...." arrrghghghghgh)>
So, now I read oracle's email....
Right:
cron env is /bin/sh; and my backup script has #!/bin/bash as the first line, of course, so that's the shell environment.
/bin/sh: -c: line 1: syntax error near unexpected token `&'
/bin/sh: -c: line 1: `/home/oracle/dbbackup.sh >> /opt/oracle/backup/backup.log 2>>&1'
So it's a syntax error in the crontab entry... but *why*?
Ok, just went into Bourne, and it doesn't like 2>>&1. So, a simple question: won't it toast backup.log if I don't do that as an append - that is, if I do 2>&1, instead of 2>>&1?
mark
More information about the redhat-list
mailing list