1752727 Members
5534 Online
108789 Solutions
New Discussion юеВ

Re: crontab

 
Ahmed Ibrahim_3
Occasional Advisor

crontab

Hi,

We useing HP9000 V-class system HP-UX 11.x and hosting oracle8 release 11.

I am using a script with user x and schedule it using crontab to run over
night, but it failed the error message which i am getting is as follows : -


oracle8/oracle8/stoporacle8: MANPATH: Parameter not set.
logout
*************************************************
Cron: The previous message is the standard output
and standard error of one of your crontab commands:

/oracle8/oracle8/stoporacle8
Please help if you face such problem.

Regards


9 REPLIES 9
Melvyn Burnard_1
Regular Advisor

Re: crontab

In your script, are you setting ALL the environment variables correctly?
It looks like the script is looking for the MANPATH variable, and this is not
set.
I would suggest you add this in to the script.
CHRIS ANORUO
Honored Contributor

Re: crontab

Hi Ahmed,

You have to include the PATH in your oracle and root .profiles and export the PATH.

Cheers!
When We Seek To Discover The Best In Others, We Somehow Bring Out The Best In Ourselves.
Albert E. Whale, CISSP
Honored Contributor

Re: crontab

Ahmed,

First of all, the Cron tab error indicates that your Environment is not being setup properly for the Cron Job.

You can fix this one of two ways:

1. inside the script, source your evironment manually (i.e.
. .profile)

2. Execute the application from Root's Cron with the Following command:

/bin/su - {user x} -c "Script Name and all arguments"

The later will always work, however it does not allow the User to understand that the problem is that they need to establish the environment variable which they have when they are an interactive user.

Hope that helps.
Sr. Systems Consultant @ ABS Computer Technology, Inc. http://www.abs-comptech.com/aewhale.html & http://www.ancegroup.com
David Seijo
New Member

Re: crontab

Hey ...I know you posted this question long time ago..but just in case you come back one day...for some reason you remember me one of my friends...is your last last name Rashard (or rachard)?
Don't have one right now....
glovecar
Occasional Advisor

Re: crontab

- root user login
# crontab -l > crontest
# vi crontest
0 23 * * * /usr/bin/su - root -c "/oracle8/oracle8/stoporacle8"
# crontab crontest

Re: crontab

Hi

#vi /oracle8/oracle8/stoporacle8.sh
;ORACLE ORACLE STOP
su - oracle8 <
Srini_2
New Member

Re: crontab

My cron jobs are failing for the same reason too.
"MANPATH not set". This happens even when I source
my .profile. The problem is fixed when I added MANPATH
to my .profile. Any clues as to why the cron is sensitive
to MANPATH?

OS: hpux 11 64 bit.
lambu
Alexander M. Ermes
Honored Contributor

Re: crontab

Hi there.
Usually you have a file called oraenv. In this file all variables for Oracle should be set. This script will also be run in the .profile of the user oracle. If you want to shutdown and startup Oracle with cron, try this way :
setup user oracle ( group dba )
Use this user for shutdown and startup.
There are standard scripts from Oracle for startup and shutdown ( dbstart / dbshut ). You should read all lines in /etc/oratab and do a shutdown and startup with the Oracle SIDs as parameters.
Sample line in cron :

su - oracle -c 'dbshut_all'

su - oracle -c 'dbstart_all'

If you need samples of these scripts, pls let me know and email me at Alexander_Ermes@web.de.
Rgds
Alexander M. Ermes
.. and all these memories are going to vanish like tears in the rain! final words from Rutger Hauer in "Blade Runner"
Bill Hassell
Honored Contributor

Re: crontab

One of the overlooked features of cron is that is has little resemblance to a normal login. The crontab man page mentions that there is no login and virtually no environment. That means that /etc/profile and .profile are not executed when the job runs.

Some cron jobs will use the su - oracle method to run on Oracle's behalf and this will login but since cron has no terminal, tty-only commands like ttytype and tset and tabs will fail with "not a typewriter" errors.

So /etc/profile and .profile need to have tests for an interactive tty before running these commands, something like:

if tty -s
then
eval (ttytype -s)
tabs
fi

Another thing to compare: Login as the oacle user and type the commands: set and env. Then create a cronjob similar to the Oracle start/stop scripts which add set and env at the beginning so you can see the differences.


Bill Hassell, sysadmin