1833758 Members
2995 Online
110063 Solutions
New Discussion

Cronjob

 
MILAN MURALIDHARAN_1
Occasional Advisor

Cronjob

The new Cronjob i setup fails with the following Mail messasge:

"From root Tue Apr 24 08:08:01 EDT 2001
Received: (from root@localhost)
by usnjpav1.itxc.com (8.8.6 (PHNE_17190)/8.8.6) id IAA06903
for xps_prd; Tue, 24 Apr 2001 08:08:01 -0400 (EDT)
Date: Tue, 24 Apr 2001 08:08:01 -0400 (EDT)
From: root
Message-Id: <200104241208.IAA06903@usnjpav1.itxc.com>
Subject: cron

Message file sp1.msb not found
Error 6 initializing SQL*Plus


*************************************************
Cron: The previous message is the standard output
and standard error of one of your crontab commands:

/xps_prd/express/work/xps_prd/arwatch.sh "


The Entry in the log file is:

"CMD: /xps_prd/express/work/xps_prd/arwatch.sh
> xps_prd 6896 c Tue Apr 24 08:08:00 EDT 2001
< xps_prd 6896 c Tue Apr 24 08:08:01 EDT 2001 rc=1 "

Attached is the cronjob file for ref.
Appreciate your details for the Cronjob failures.
PERSISTENCE PERFORMS
5 REPLIES 5
A. Clay Stephenson
Acclaimed Contributor

Re: Cronjob

All those pesky little environment variables
you commented out (PATH,ORACLE_SID,SQL_PATH, etc.) need to be properly defined for the cronjob to work. Cron's environment is very sparse because it does not source a user's .profile where those variables are normally set. You might want to setup a file
(e.g. /usr/local/bin/oraclestuff.sh)
ORACLE_SID=xxx
ORACLE_BASE=yyy
ORACLE_HOME=${ORACLE_BASE}/product/8.1.7
PATH=/usr/bin:/bin/:/usr/local/bin:${ORACLE_HOME}/bin

export ORACLE_SID ORACLED_HOME ORACLE_BASE PATH

You would probably want more than that but that should give you the idea of the file's
contents. Do not include an exit in the file because the script called from cron
will do something like
. /usr/local/bin/oraclestuff.sh
to include all these common variables.
Typically this cronjob should be executed by oracle.
If it ain't broke, I can fix that.
Philip Chan_1
Respected Contributor

Re: Cronjob

Just the cron job don't know where to find the sp1.msb file. Make sure all your Oracle related environment variables are being set properly WITHIN your cron job. Remember, by default your .profile will NOT be executed in your cron job therefore you have to pick up any env variables needed.

Rgds,
Philip
MILAN MURALIDHARAN_1
Occasional Advisor

Re: Cronjob

I am still getting the following messages and the Cronjob is not running after modifying the file :

" From root Wed Apr 25 16:09:01 EDT 2001
Received: (from root@localhost)
by usnjpav1.itxc.com (8.8.6 (PHNE_17190)/8.8.6) id QAA17319
for xps_prd; Wed, 25 Apr 2001 16:09:00 -0400 (EDT)
Date: Wed, 25 Apr 2001 16:09:00 -0400 (EDT)
From: root
Message-Id: <200104252009.QAA17319@usnjpav1.itxc.com>
Subject: cron


/usr/bin:/usr/sbin:.
/usr/bin:/usr/sbin:.
HOME=/xps_prd/express
LOGNAME=xps_prd
PATH=/usr/bin:/usr/sbin:.
PWD=/xps_prd/express/work/xps_prd
SHELL=/usr/bin/sh
TZ=EST5EDT
_=/usr/bin:/usr/sbin:.
/xps_prd/express/work/xps_prd/arwatch.sh[8]: /usr/bin:/usr/sbin:.: This is not an identifier.


*************************************************
Cron: The previous message is the standard output
and standard error of one of your crontab commands:

/xps_prd/express/work/xps_prd/arwatch.sh "

Modified file is in the attachment.

Appreciate your help.

PERSISTENCE PERFORMS
Chin Guan
Valued Contributor

Re: Cronjob

If your script does not specify which shell to execute, It will be using /usr/bin/sh (POSIX Shell by default). The syntax of the scripts might have to be change.....

cd work/xps_prd
ORACLE_SID=XPS_PRD
PATH=$PATH:/xps_prd/express/work/xps_prd:/oracle/app/oracle/product/8.0.5/bin
export $ORACLE_SID
export $PATH
/oracle/app/oracle/product/8.0.5/bin/sqlplus / @arwatch.sql

Thierry Poels_1
Honored Contributor

Re: Cronjob

Hi,
do NOT define the Oracle environment variables in every script. Put them in a separate file, and source this file.
If your settings change (for example after an upgrade) you might need to modify tons of scripts.
BTW this does not apply to Oracle only.

regards,
Thierry.
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.