[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cobalt-users] Ambiguous Redirest by Cron
- Subject: Re: [cobalt-users] Ambiguous Redirest by Cron
- From: "Jeffery L. JT Vogt" <lfm@xxxxxxxxxxxxxxxxxx>
- Date: Sun Mar 18 05:42:02 2001
- List-id: Mailing list for users to share thoughts on Cobalt products. <cobalt-users.list.cobalt.com>
>Does anyone know why I am getting the following e-mail error from root
>every quarter hour?
>
>Subject: Cron <root@ns1> /usr/local/sbin/swatch
>>>/var/cobalt/adm.log 2>&1
> To: root
>
>/bin/bash: 1
>: Ambiguous redirect
>
>This is happening on a new Raq4 with all the patches applied and cron
>does not seem to be working and updating virtual sites log or stats.
Paul,
Check the program "swatch" and the entry in the crontab (if you're using
the cron.hourly and friends, the offending script will be there,
otherwise it will be called from /etc/crontab).
The "ambiguous redirect" is an error from a shell that doesn't handle
labelling and using I/O streams the same way as the old standby "/bin/sh".
For example, if /usr/local/bin/swatch is a Bourne or Bash script that
wants to redirect stderr to stdout, it'll use "2>&1". If, however, its
being invoked by csh, tcsh, or someone of that ilk, it will balk at this
type of redirection with this syntax.
So, two things I'd do, "be I were you":
- If the shell script is the one containing the redirect, then at the
first line of the shell script, invoke the proper shell like this:
#!/bin/bash
Note that the "#!" MUST be the FIRST thing on the line (i.e. no
whitespace)
- If the redirect is in the crontab (yikes!), then create a wrapper
program like /usr/local/bin/mywrapper that looks something like this:
#!/bin/bash
prog=$1
args="$*"
$prog $args > whateverfile 2>&1
"whateverfile" should be whatever the redirection is currently going
to (/var/cobalt/adm.log).
Make it executable:
chmod 755 /usr/local/bin/mywrapper
Call "/usr/local/bin/mywrapper" instead of program-to-be-called in
your crontab (without the redirection, but with the argument
"program-to-be-called":
02 3 1 * * root /usr/local/bin/mywrapper program-to-be-called arguments
Note for the tech-heads who love to jump all over things: This is a
quick and dirty fix. Yes, I realise there are other ways to do this.
But tell you what... after 20 years of Unix, I go for the "quick and
dirty" in most cases, to get results. If Paul wants the "whys and
wherefores" and wants to finesse things, I'll be more than happy to, in
private email, handle that.
So flames, snide comments, etc. to /dev/null.
-Arf, JT
------------------------------------------------------------------------------
"Outlook is a massive flaming horrid blatant security violation, that
also happens to be a mail reader."
- Frang (FurryMuck)
Join the UniServe Seti@Home Team: http://www.unisrv.net/computerguys/seti
Unix, Networking and ISP Consulting lfm@xxxxxxxxxx
http://www.unisrv.net MSN IM: S_A_Alis@xxxxxxxxxxx ICQ 9099687
FurryMUCK (muck.furry.org 8888): S'A'Alis www.unisrv.net/lfm MSTie# 21756