- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: at and cron issues
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2001 06:22 AM
09-05-2001 06:22 AM
We have a job that shuts down an Oracle database. When we run the job via cron, we get permissions problems and the script doesn't work (it runs, it just doesn't shut the database down). When we use the "at" command, it works. We used both cron and at as root. "at" works, cron doesn't. Any ideas?
-Tim
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2001 06:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2001 06:29 AM
09-05-2001 06:29 AM
Re: at and cron issues
Just an idea : I think you can verify you
have the same environment with at and cron.
I think that cron use a minimal environment.
In this case you need to modify your environment
(variables to export) before execution.
HTH
Herv?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2001 06:32 AM
09-05-2001 06:32 AM
Re: at and cron issues
The problem is that the cron environment is very sparse. You need to set and export ORACLE_SID,ORACLE_HOME,PATH, etc. either explicitly in your script or better still as as '.' sourced file in your script. The best way is to create scrits which set and export these variables. Do not put an exit statement in these scripts because both your .profiles and your cron scripts should source these file
e.g. . /usr/local/bin/oraenv.sh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2001 06:36 AM
09-05-2001 06:36 AM
Re: at and cron issues
-Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2001 06:37 AM
09-05-2001 06:37 AM
Re: at and cron issues
cron by default sets a minimal set of environment variables
HOME=user's-home-directory
LOGNAME=user's login id
PATH=/usr/bin:/usr/sbin:.
SHELL=/usr/bin/sh
where as "at" sets up the environment to match the environment when the at command was given.
So for your script to work correctly in cron, its always a good idea to source your .profile or the file containing your environment variables.
For more information check the man pages of at, cron and crontab
-Ramesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2001 06:49 AM
09-05-2001 06:49 AM
Re: at and cron issues
Thanks again for the help! I am a firm believer in the points system, and do not normally give out 10's to more than 1 person in a post, but the speed and accuracy with which you all nailed the answer left me no choice.
Thanks again!
-Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2001 03:51 PM
09-05-2001 03:51 PM
Re: at and cron issues
You need to set your environement variables at the begining of your crontab job by the following command :
#. /.profile
This will set all variables needed for your cron job ( of course it should work in interactive mode ! ).
Magdi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2001 02:09 AM
09-06-2001 02:09 AM
Re: at and cron issues
1.add the script directory to your path variable.
2.Use the crontab of oracle user to shutdown the database.
crontab -e oracle
Then add your script of shutdb.
If it doesn't work then take the entry of the crontab file and add it again,then try it out.
for ex: your database shutdown script(shutdb) is like
echo "enter the sid for oracle :\c"
read ORACLE_SID
export ORACLE_SID
/opt/app/oracle/product/8.1.5/bin/svrmgrl << !
connect internal;
shutdown immediate;
!
Thanks
G Manikandan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2001 05:14 AM
09-06-2001 05:14 AM
Re: at and cron issues
If you have a script run by root to start and stop oracle such as in /sbin/init.d you should have it su to oracle;
"su - oracle -c /path_of_oracle_script"