Operating System - HP-UX
1748092 Members
5781 Online
108758 Solutions
New Discussion юеВ

Re: Addendum to my cron woes

 
Ron Irving
Trusted Contributor

Addendum to my cron woes

Hi again guys. It would appear that I closed my last one a little too quickly. (Maybe I'm just too excited to get home for a spell. It's been a LONG 3 months.)

I checked the mail for oraprod, (the offeding user that won't run the cron job.) I get this when the scripts attempts to run through cron:

The Configuration file cfg/install.cfg does not exist

Any ideas? The same guys who responded to my last one, if you will repond to this, I will distribute points accordingly. I'm good about that.

Regards,

Ron
Should have been an astronaut.
5 REPLIES 5
Steven E. Protter
Exalted Contributor

Re: Addendum to my cron woes

Shalom Ron,

Is the system trusted? There is a special procedure for enabling cron for certain users on a trusted system.

The error you report has nothing to do with cron. It is with the script you are running.

Since its past bed time and I'm working on a broke system. I will give you the fix to get the cron job working trusted without confirmation.

http://h30499.www3.hp.com/t5/System-Administration/crontab-don-t-run-in-trusted-system/m-p/3345484#M191545

http://h30499.www3.hp.com/t5/System-Administration/how-to-enable-the-crontab-for-user-in-hpux/m-p/5234822#M468957

SEP

Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Matti_Kurkela
Honored Contributor

Re: Addendum to my cron woes

I guess some Oracle-specific environment variables (like ORACLE_HOME) are not set in the cron environment.

As "man crontab" says, the default environment for cron jobs is very minimal (this example from HP-UX 11.23):
----
HOME=user's-home-directory
LOGNAME=user's-login-id
PATH=/usr/bin:/usr/sbin:.
SHELL=/usr/bin/sh
----

The cron job script should set up all the necessary environment variables itself, either by running /etc/profile and $HOME/.profile, or by explicitly initializing the variables it needs.

MK
MK
Ron Irving
Trusted Contributor

Re: Addendum to my cron woes

I'm with you Matti!

What should the command line look like then? Right now it's /u03/oracle/oraprod/backup/do_backup.sh

Should I add in $HOME/.profile before the command? The man page is not real specific on this point.

Regards,

Ron
Should have been an astronaut.
James R. Ferguson
Acclaimed Contributor

Re: Addendum to my cron woes

Hi Ron:

> Should I add in $HOME/.profile before the command? The man page is not real specific on this point.

In my opinion, no, because unless you have conditioned the terminal-specific commands like 'stty' to be run only if your shell is an interactive one, you will end up with the "not a typewriter" messages which if un-redirected will cause 'cron' to create mail for you.

A far better alternative is to either declare the variables you need in your script or to source (read) a file containing them:

# . /home/oracle/envvars

Note the dot followed by whitespace. If you choose this technique you could also remove hard-coded variables from the profile and simply source the external file. This has the additional advantage of having only one place (file) to add, modify or delete requisite variables.

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

Re: Addendum to my cron woes

Your previous thread:
http://h30499.www3.hp.com/t5/System-Administration/cron-woes/m-p/5283860#M474719


>Should I add in $HOME/.profile before the command?

You could but it may be easier to just put it in your script with a comment about crontab?

Otherwise something like:
00 03 * * * . $HOME/.profile; /u03/oracle/oraprod/backup/do_backup.sh