From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96079271218417.tru64-unix-managers.marc@archive.invalid> From: Russ_Fish () idx ! com Date: Fri, 07 Jan 2000 19:06:37 +0000 To: tru64-unix-managers Subject: ksh(?)/cron error opening here document on /tmp X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96079271218417 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 " 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 / < 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