crontab issue

Dear Folks,

i am new to hp-ux, i have a problem scheduling the crontab,
The script is working fine at command prompt, but not working at cron, please find a solution for it ,

here are the logs and my schedule at cron:
log after restarting crontab /var/adm/cron/log
! *** cron started *** pid = 24393 Thu Jan 3 12:33:16 IST 2008
> CMD: /home/oracle/fullexp.sh >> /home/oracle/run.log
> oracle 24481 c Thu Jan 3 12:35:00 IST 2008
< oracle 24481 c Thu Jan 3 12:35:00 IST 2008 rc=1
~
~
~
~
~
######################################################

#!/usr/bin/sh
export EDITOR=vi
export ORACLE_SID=mibast
export ORACLE_BASE=/home/oracle/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export DISPLAY=10.1.9.21:0:0
PATH=$ORACLE_HOME/bin:$PATH
export PATH
export SHELL=usr/bin/bash
/home/oracle/oracle/product/10.2.0/db_1/bin/exp system/manager file='/data3/expo
rt/full_26.dmp' log='/data3/export/full_26.log' full=y consistent=y buffer=99999
99 statistics=none

But still no luck, please find the solution.

What is the error message that you got?

Thanks
Nagarajan G

You can't make SHELL a relative path.
export SHELL=/usr/bin/bash
might make sense if bash is really in /usr/bin. This needs to the the absolute path to a shell.

Hi vaddi,

I have just released that your absolute path in your crontab entry should read, I think;

> CMD: /home/oracle/oracle/fullexp.sh >> /home/oracle/run.log

your entry

> CMD: /home/oracle/fullexp.sh >> /home/oracle/run.log

See Below

#!/usr/bin/sh
export EDITOR=vi
export ORACLE_SID=mibast
export ORACLE_BASE=/home/oracle/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export DISPLAY=10.1.9.21:0:0
PATH=$ORACLE_HOME/bin:$PATH
export PATH
export SHELL=usr/bin/bash
/home/oracle/oracle/product/10.2.0/db_1/bin/exp system/manager file='/data3/expo
rt/full_26.dmp' log='/data3/export/full_26.log' full=y consistent=y buffer=99999
99 statistics=none

I hope this is of help

Jnike

If its working fine at command prompt and not in the batch mode, then your issue is about your environment...
For instance PATH=<something>:$PATH is equal to PATH=<something>:/usr/bin... So be sure to export the PATH to all your called binaries...
No variables are set except the ones you specify...
Put all your needed variables in a file and execute it :
. /absolutePathTo/loadmyvars
then execute your script!
So this is what we should see in your Newscript for batch:
#!/usr/bin/ksh #or whatever
. /absolutePathTo/loadmyvars
myolscriptthatdidntwork
exit

If you want to check, just put in a script
. /to-oraclehome/.profile
script

It should work..

Good luck
Vic

Dear Nagarajan ,

the log is not being generated so nothing to see

Dear Folks,

Thanks for ur reply,

here is the environment variables , please go through it and get me the right solution for the script.:b:

env variables(oracle)

$ env | grep ORACLE
ORACLE_BASE=/home/oracle/oracle
ORACLE_SID=mibast
ORACLE_HOME=/home/oracle/oracle/product/10.2.0/db_1
$ env | grep oracle
PATH=/home/oracle/oracle/product/10.2.0/db_1/bin:/usr/bin:/opt/ansic/bin:/usr/cc
s/bin:/usr/contrib/bin:/opt/hparray/bin:/opt/nettladm/bin:/opt/upgrade/bin:/opt/
fcms/bin:/usr/bin/X11:/usr/contrib/bin/X11:/opt/pd/bin:/opt/wbem/bin:/opt/wbem/s
bin:/opt/resmon/bin:/opt/firefox:/opt/gnome/bin:/opt/mozilla:/opt/graphics/commo
n/bin:/opt/hpsmh/bin:/opt/perl_32/bin:/opt/perl_64/bin:/usr/sbin/diag/contrib:/o
pt/sfm/bin:/opt/ssh/bin:/opt/thunderbird:/opt/gwlm/bin:/opt/aCC/bin:/opt/cadvise
/bin:/opt/langtools/bin:/opt/imake/bin:.
ORACLE_BASE=/home/oracle/oracle
LOGNAME=oracle
HOME=/home/oracle
LD_LIBRARY_PATH=/home/oracle/oracle/product/10.2.0/db_1/lib
ORACLE_HOME=/home/oracle/oracle/product/10.2.0/db_1
$

can you kindly post your cron entry as well?

hi quintet

Here is the cron entry:>

$ crontab -l
52 16 * * * /home/oracle/oracle/product/10.2.0/db_1/fullexp.ksh
$

here is the fullexp.ksh script:>

#!/usr/bin/ksh
export EDITOR=vi
export ORACLE_SID=mibast
export ORACLE_BASE=/home/oracle/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export SHELL=usr/bin/ksh
export PATH=$ORACLE_HOME/bin:/usr/local/bin:/bin:/usr/bin
/home/oracle/oracle/product/10.2.0/db_1/bin/exp system/manager file='/data3/expo
rt/fullexp_31.dmp' log='/data3/export/fullexp_31.log' full=y consistent=y buffer
=9999999 statistics=none

change the cron entry to

52 16 * * * /home/oracle/oracle/product/10.2.0/db_1/fullexp.ksh 1>/tmp/log.txt 2>&1

and check for any erroro message in that log

hi quintet

i have changed the cron entry but no luck, the log is not getting generated.

I can find this message in /var/adm/cron/log

> CMD: /home/oracle/oracle/product/10.2.0/db_1/fullexp.ksh 1>/tmp/log.txt 2>&1
> oracle 20813 c Thu Jan 24 16:32:00 IST 2008
< oracle 20813 c Thu Jan 24 16:32:00 IST 2008 rc=1

>export SHELL=usr/bin/ksh
This line has nothing to do in your script since you have decided to use the ksh shell (your first line is calling it..) especially when wrong! -> Where is the slash in front of usr?