tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* SUMMARY: ksh(?)/cron error opening here document on /tmp
@ 2000-01-11  2:15 Russ_Fish
  0 siblings, 0 replies; only message in thread
From: Russ_Fish @ 2000-01-11  2:15 UTC (permalink / raw)
  To: tru64-unix-managers


To:   Tru64 Unix Managers

My original msg is at the bottom.

All the admin-level stuff I tried (add quotas to root
domain & run quotacheck, AdvFS verify, recreate /tmp)
failed to solve the problem. What did work was changing
the syntax of the here document to use backticks rather
than the ksh "$()" syntax. So I changed

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')

to

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'`

and it's been running like a champ ever since. If one of the
shell/cron experts can tell me why, I'd love to know, but it's
working so I can also live in blissful ignorance. Happy (quiet)
New Millenium to the list members.

--Russ


---------------------- Forwarded by Russ Fish/SEA/IDX1 on 01/10/2000 06:05 PM
---------------------------


Russ_Fish@idx.com on 01/07/2000 11:06:37 AM

To:   tru64-unix-managers
cc:    (bcc: Russ Fish/SEA/IDX1)
Subject:  ksh(?)/cron error opening here document on /tmp
Body:



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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-01-11  2:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-01-11  2:15 SUMMARY: ksh(?)/cron error opening here document on /tmp Russ_Fish

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