From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96078724212190.tru64-unix-managers.marc@archive.invalid> From: Isidoro Sepe Date: Thu, 29 Oct 1998 09:42:55 +0000 To: tru64-unix-managers Subject: Summary: Problems with crontab X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96078724212190 Thanks to: Sudhir Rao, Dale Inman, Dejan Muhamedagic, Agust Karlsson, J.James(Jim)Belonis II, Russ Fish. The question was: >>I have to run via cron a script that exports an Oracle Database. >>The script runs fine from shell but it doesn't run if submitted by >>crontab. >>The system is a server 4100 DigitalUNIX 4.0D. >>The script looks like this: >>#!/bin/sh >>ORACLE_HOME=/path;export ORACLE_HOME >>ORACLE_SID=SiD;export ORACLE_SID >>${ORACLE_HOME}/bin/svrmgrl <>connect internal >>--shutdown abort >>--startup exclusive open restrict >>host ${ORACLE_HOME}/UTL/BCK/bck >>--alter system disable restricted session; >>exit >>FINE I received a lot of excellent hints but my actual problem was that I didn't export LD_LIBRARY_HOME=$ORACLE_HOME/lib (This was stated by Russ Fish). These are the hints I received: 1) Try su - oracle -c /path/to/script 2)When I have trouble in crontab it is usually for one of two reasons. 2.1) The script that I am running from cron is one that I have forgotten to make executable or I have a typo in the path or name of the script. 2.2) Pathing issues / Enviromental variables in the script. All of my database specific, special pathing, etc. come out of /etc/profile. Cron does not execute the profile so it is necessary to put all your pathing statements into the shell. 3)Not sure, but I think that the Oracle's programs don't like when there's no controlling terminal. You didn't specify the actual error messages which should have been sent by mail from the crond. So, I'd suggest using the svrmgrl twice (first for dbshut and then for dbstart) and performing backup in between. 4)cron jobs run under a VERY restricted environment. You might test by running a cron job like printenv or printenv >/tmp/cron_printenv_test It will show you the PATH environment variable and others that might not be set properly to run the Oracle job. You may have to explicitly source the .profile or .login or .cshrc file to get the environment set the way you need it. When you say "doesn't run" it could mean that cron is somehow screwed up so cron doesn't run anything ever. The above test should help you verify that you can indeed run cron jobs at all. If all looks well, you can instrument the actual cron job by adding the printenv line to it. This will create a file so you can tell whether the Oracle cron job ran at all. If it runs but aborts early or doesn't do what you want, redirect the output of the svrmgrl command to a file so you have a record of what kind of error message you might be getting. Grazie. Ciao. ______________________________________________ Isidoro Sepe - Telesoft spa Via Vicinale S.Maria del Pianto,snc 80143 Napoli Phone : +39-81-7564486 Fax : +39-81-7564252 email : isidoro.sepe@tlsoft.it ______________________________________________