tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: Russ_Fish () idx ! com
To: tru64-unix-managers
Subject: ksh(?)/cron error opening here document on /tmp
Date: Fri, 07 Jan 2000 19:06:37 +0000	[thread overview]
Message-ID: <96079271218417.tru64-unix-managers.marc@archive.invalid> (raw)


To:   tru64-unix-managers
I have a cron job which is running some of the time but not all of the time.
I've included the entire script at the bottom of this msg. The cron is using
a here document to run an oracle select statement, and it's failing with the
following error (ksh -x output):

+ export PATH=/usr/bin:/usr/ccs/bin:/usr/sbin:/usr/local/bin
+ [[ -z srvname ]]
+ [[ -z testalias ]]
+ cut -d: -f1 /etc/oratab
+ grep -v ^#
+ grep -v ^\*
+ grep srvname
+ [[ -z srvname ]]
+ [[ ! -a /usr/users/oracle/.mailrc ]]
+ grep testalias /usr/users/oracle/.mailrc
+ [[ -z alias testalias some_admin@idx.com ]]
+ export ORACLE_SID=srvname
+ export ORACLE_HOME=/u01/app/oracle/product/7.3.4
+ export MAILRCP=testalias
+ + sed -e /^$/d
+ /u01/app/oracle/product/7.3.4/bin/sqlplus -s /
+ /usr/local/$admin/bin/chkfaileddbajobs[45]: /tmp/sh27954.2: cannot open   <--
BADJOBS=

I cannot discern a pattern to the failures. Our /tmp directory gets a lot of
user writes
(application log files) and does not have quotas enabled, so I will add quotas
over
the weekend and run verify on the root domain. If anyone has other suggestions
on
resolving this issue, let me know (esp. if you've got a fix that lets me skip
the weekend
work :)).

Coding suggestions, sed/awk tricks, etc. are also welcome.

--Russ
----------
Russell C. Fish                              IDX Systems Corp.
Oracle DBA/Unix System Admin                 1001 4th Ave. Suite 1500
PH: 206-689-1302                             Seattle, WA 98154
mailto:russ_fish@idx.com

-------------- script follows -----------------------

#!/usr/bin/ksh
# check for jobs with nonzero failure count
# send email to $MAILRCP if found

# script path
export PATH=/usr/bin:/usr/ccs/bin:/usr/sbin:/usr/local/bin

# make sure instance name passed as input
if [[ -z $1 || -z $2 ]]; then
  print "usage: chkfaileddbajobs <instance> <mailalias>"
  exit 1
fi

# make sure instance is a legal one
if [[ -z $(cut -d':' -f1 /etc/oratab | grep -v "^#" | grep -v "^\*" | grep $1)
]]; then
  print "error: invalid instance $1 passed to $0"
  exit 1
fi

# make sure mail alias exists
if [[ (! -a ~/.mailrc) || -z $(grep $2 ~/.mailrc) ]]; then
  print "error: invalid mail alias $2 passed to $0"
  exit 1
fi

# Oracle setup
export ORACLE_SID=$1
export ORACLE_HOME=/u01/app/oracle/product/7.3.4

# alias is defined in ~/.mailrc
export MAILRCP=$2

# get info on failed jobs
# sed line removes blank lines
# note calling user must have 'OPS$' account & dba privs on instance
BADJOBS=$({
$ORACLE_HOME/bin/sqlplus -s / <<END
set heading off
select job, priv_user, what from dba_jobs where failures > 0;
exit
END
} | sed -e '/^$/d')

# if errors found, email/page the appropriate people
if [[ -n $BADJOBS ]]; then
    print $BADJOBS | sed -e 's/;/\
/' |  mailx -s "URGENT: failed jobs in DBMS_JOB" $MAILRCP
fi

                 reply	other threads:[~2000-01-07 19:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox