The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Execute oracle query determined at runtime from a unix script infyanurag Shell Programming and Scripting 4 02-01-2008 07:54 AM
setting Oracle Home DILEEP410 Shell Programming and Scripting 3 12-14-2006 08:15 AM
command to schedule a unix script in tidal' scheduler balireddy_77 UNIX for Advanced & Expert Users 0 10-10-2006 01:03 AM
event scheduler/tracker script theangrybeaver Shell Programming and Scripting 1 01-09-2006 05:38 PM
Hardware dummy trying to set up Unix workstation for Oracle at home for practice! tmanpakdee UNIX for Dummies Questions & Answers 4 12-07-2001 04:04 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-13-2007
shew01 shew01 is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 41
$HOME Not Getting Set for Oracle Scheduler Script at Runtime

We are researching the possibility of using Oracle 10g Scheduler on Solaris 10 to launch scripts at our site, and the script that I am testing does not get $HOME (and other environment variables) set correctly. Here is the Korn shell script (show_info.ksh):

#!/usr/bin/ksh
id
env | sort


Here is the output from the script when it is executed interactively (I removed the extraneous Oracle variable displays for brevity):

. ./show_info.ksh
+ id
uid=100(oracle) gid=1978(dba)
+ sort
+ env
$
_=/usr/bin/env
DBA_LOGS=/usr/oracle/scripts/logs
EDITOR=vi
HOME=/usr/oracle
LOGINFROM=n.n.n.n
LOGNAME=oracle
PATH=/u01/app/oracle/product/10g/bin:/u01/app/oracle/product/10g/OPatch:/usr/bin:/usr/local/bin:/usr/ccs/bin:/usr/local/sbin:/usr/sbin
PS1=${LOGNAME}-${ORACLE_SID}-${PWD}
PWD=/usr/oracle/jps/oracle_scheduler
SHELL=/bin/ksh
SystemEnvironment=0200P
TERM=dtterm
TZ=US/Eastern
USER=oracle


Here is the output from the script when it is executed by cron—this appears to be running the Bourne shell, despite the Korn bang line, correct?:

+ id
uid=100(oracle) gid=1978(dba)
+ sort
+ env
HOME=/usr/oracle
LOGNAME=oracle
PATH=/usr/bin:
PWD=/usr/oracle
SHELL=/usr/bin/sh
TZ=US/Eastern
_=/usr/bin/env


Here is the output from the script when it is executed by Oracle Scheduler (dbms_scheduler)—this is what I’m trying to “fix:”

uid=100(oracle) gid=1978(dba)
PWD=/
_=/usr/bin/env


Questions:
  1. Which shell is running when the script is launched by Oracle Scheduler?
  2. How can I get $HOME to be defined correctly?

J
  #2 (permalink)  
Old 12-13-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
You may need to export all the variables so child processes will see them.
  #3 (permalink)  
Old 12-13-2007
shew01 shew01 is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 41
Quote:
Originally Posted by porter View Post
You may need to export all the variables so child processes will see them.
Where does $HOME get set during a process login?
  #4 (permalink)  
Old 12-13-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
Quote:
Originally Posted by shew01 View Post
Where does $HOME get set during a process login?
I thought "login" would do it.

The traditional sequence is init -> getty -> login -> shell.

cron is lightweight and doesn't do a full log in, it sort of just impersonates the user.
  #5 (permalink)  
Old 12-14-2007
shew01 shew01 is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 41
Quote:
Originally Posted by porter View Post
The traditional sequence is init -> getty -> login -> shell.
Can you elaborate a bit--I don't understand what you mean. Can you specifiy the file names that are called during the login process?

Quote:
Originally Posted by porter View Post
cron is lightweight and doesn't do a full log in, it sort of just impersonates the user.
Apparently, Oracle Scheduler is even more lightweight. It barely impersonates the user.

I can hardcode some syntax to get around this problem, but we'll need to "rip and replace" a bunch of code if the user changes in the future, or if the disk farm changes, or if whatever else changes.... I'd like to keep the configuration generic and let the system to figure out $HOME at a minimum, and it would be nice if it would populate $SHELL too. From there, I should be able to source whatever other scripts that I need.

Is there a way to figure out which shell is running when $SHELL is not populated?
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:12 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0