Issue with a Unix script Env setting


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Issue with a Unix script Env setting
# 1  
Old 02-21-2011
Issue with a Unix script Env setting

Hi,

I have the below script


Code:
#------------------------------------------------------------------------------
#Set up environment variables
#------------------------------------------------------------------------------

SCRIPTS_DIR=/remedy/scripts/ServerVolumeBilling
EXTRACT_DIR=/remedy/scripts/ServerVolumeBilling
WORKING_DIR=/remedy/scripts/ServerVolumeBilling
TODAYS_DT=`date +"%m/%d/%Y"`
LOG_DIR=/remedy/scripts/ServerVolumeBilling/Logs
TODAYS_DT=`date "+%m/%d/%y"`
TODAYS_DD=`date "+%d"`
TODAYS_MM=`date "+%m"`
TODAYS_YY=`date "+%y"`
TODAYS_DOW=`date "+%a"`
TODAYS_CCYY=`date +"%Y"`
TODAYS_CCYY_DT=`echo $TODAYS_MM$TODAYS_DD$TODAYS_YY | sed 's/ //g'`

#------------------------------------------------------------------------------
#Variables for Sqlplus
#------------------------------------------------------------------------------
#export TNS_ADMIN=/opt/oracle/product/10g_client/network/admin
#export ORACLE_BASE=/u01/app/oracle/
#export ORACLE_HOME=/opt/oracle/product/10g_client/
#export LD_LIBRARY_PATH=/usr/ar/cidcsremdapp1/bin:$ORACLE_HOME/lib32:$ORACLE_HOME/lib:/usr/jdk/instances/jdk1.5.0/jre/lib/sparc/:/usr/lib:/usr/ucblib
#export LD_LIBRARY_PATH=/usr/ar/ftdcsremdapp1/bin:$ORACLE_HOME/lib32:$ORACLE_HOME/lib:/usr/jdk/instances/jdk1.5.0/jre/lib/sparc/:/usr/lib:/usr/ucblib
export LD_LIBRARY_PATH=/usr/ar/cidcsrempapp1/bin:$ORACLE_HOME/lib32:$ORACLE_HOME/lib:/usr/jdk/instances/jdk1.5.0/jre/lib/sparc/:/usr/lib:/usr/ucblib
#export PATH=$ORACLE_HOME/bin:$PATH
#export ORACLE_SID=rems1
#export ORACLE_SID=remd1
export ORACLE_SID=remp1
export TWO_TASK=ftdcsremsora1_rems1.WORLD
#export TWO_TASK=cidcsremdora1_remd1.WORLD
#export TWO_TASK=cidcsrempora1_remp1.WORLD
#SQLPLUS_PATH='/opt/oracle/product/10.2.0/bin'
SQLPLUS_PATH='/opt/oracle/product/10g_client/bin'
SQLPLUS_DIR=/remedy/scripts/ServerVolumeBilling
#------------------------------------------------------------------------------------
#Variables for file headers
#------------------------------------------------------------------------------------

HEADER='"SOURCE ID","ACCTG YR","ACCTG MO","ACCTG DAY","SUBMITTED_BY","COMPONENT_ID","WWID","BOOKING CODE","RESP CODE","CUSTOMER_CODE","VOLUME","REGION","REF1
","REF2","REF3","REF4"'
cat /dev/null > $EXTRACT_DIR/svb_report_macro_today.csv
echo $HEADER > $EXTRACT_DIR/svb_report.$TODAYS_CCYY_DT.csv
echo `date`:Running the macro
"ServerVolumeBillingScript.sh" 59 lines, 3409 characters

/usr/ar/cidcsrempapp1/bin/arsystem env sh
/usr/ar/cidcsrempapp1/bin/runmacro -o /remedy/scripts/ServerVolumeBilling/svb_report_macro_today.csv -x cidcsrempapp1 -U Demo -P demo -f TCS_AST:SBS_Reportin
gForm -t csv -n -O -q -z /remedy/scripts/ServerVolumeBilling/qualification
echo `date`:Completed Running the macro
echo `date`:Started parsing the file
awk '{print $10",",$19",",$18",",$17",",$16",",$15",",$14",",$13",",$12",",$11",",$25",",$22",",$21",",$23",",$24",",$20}' FS="," < $EXTRACT_DIR/svb_report_m
acro_today.csv > output1.csv
sed -e 's/ "//g' output1.csv > output2.csv
sed -e 's/"//g' output2.csv > output4.csv
sed -e 's/, /,/g' output4.csv > output5.csv
sed -e '1d' output5.csv >> $EXTRACT_DIR/svb_report.$TODAYS_CCYY_DT.csv
scp $EXTRACT_DIR/svb_report.$TODAYS_CCYY_DT.csv nacolx-VolumeBilling@cidcssftp01.ced.corp.cummins.com: >> $LOG_DIR/svbdata.log

when I run the above script, it doesnt run till completion because /usr/ar/cidcsrempapp1/bin/arsystem env sh once I run the following command it exits the script instead of going to the next line. I want this script to go through that line and also complete the rest of lines so that the script does whats its expected to do. Please help.

Moderator's Comments:
Mod Comment edit by bakunin: please use CODE-tags when posting code or terminal output. Thank you.

Last edited by bakunin; 02-22-2011 at 01:23 PM..
# 2  
Old 02-21-2011
Code:
...
/usr/ar/cidcsrempapp1/bin/arsystem env sh &
arsysPID=$!
wait "$arsysPID" 
...

/usr/ar/cidcsrempapp1/bin/arsystem env sh & The ampersamp "&" submit the script is a background processing so that the script continue
arsysPID=$! Store the process ID of the last job submitted in background ($!) in the arsysPID variable (the script submitted in the previous step)
wait "$arsysPID" Your script will wait until the process with PID $arsysPID is finished

Last edited by ctsgnb; 02-22-2011 at 01:13 PM..
# 3  
Old 02-22-2011
Hi,

Wat exactly are we doing by adding these steps... please tell me

Thanks
Anil
# 4  
Old 02-22-2011
I updated my previous post.
By the way you also might consider adding a
Code:
#!/usr/bin/ksh

or whatever your favourit SHELL is, to the first line of your script
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Setting ENV variables in PERL

I have perl script and in the first line we are invoking .sh script to set ENV variables. e..g eval '. $envfile; exec $PERL -S $0 "$@"' I want to change some of the env variables while the program is running and I am settging it like this .. $ENV{ORACLE_HOME}=trim($oraclehome);... (1 Reply)
Discussion started by: talashil
1 Replies

2. Shell Programming and Scripting

Shell Script for Setting Env Variables

Hello All. Good Afternoon. I need one small help regarding setting of env variables for a particular host by getting it from the DB. For ex : 1. I am using LOCALHOST. 2. When I run a ./hostset.sh it should pick up the Oracle home details from associated DB and set it. Please... (1 Reply)
Discussion started by: PavanPatil
1 Replies

3. Shell Programming and Scripting

Setting up env variable in ksh

I am facing a very strange issue. I have script in ksh with #!/bin/ksh as shebang. This script has function which sets the env variable before running other functions of the script. by set_up_env() { CONFIG_FILE="/opt/app/tools/deepmarking/latestVersion/script/UploadEnv" if then ... (7 Replies)
Discussion started by: Tuxidow
7 Replies

4. Shell Programming and Scripting

tcsh env setting using shell script

Hi All, I have made a file file usercreate.sh & it has to run in tcsh env & needs some path to be set. my script is as below. ########################## #!/bin/csh setenv PATH "/usr/lib/java/class" setenv LD_LIBRARAY_PATH ########################### but when i am ruuning my script... (1 Reply)
Discussion started by: ajaincv
1 Replies

5. UNIX for Dummies Questions & Answers

Setting env variables using script

Hi, I wrote two small scripts to set env variables in a shell. java_env.csh #!/bin/csh -fn setenv JAVA_HOME '/scratch/software/jdk1.5.0_11' setenv PATH $PATH':'$JAVA_HOME'/bin' and run it using csh ./java_env.csh But the env variables are not set. I tried running each line on the... (5 Replies)
Discussion started by: NoviceAmod
5 Replies

6. Red Hat

Help with csh env setting in Fedora 8

Hi there, How can I change bash to csh when starting a terminal, and set some aliases for csh? I can't find such files like .cshrc in my home directory. Thanks a lot (1 Reply)
Discussion started by: dustinwang2003
1 Replies

7. Shell Programming and Scripting

Script ENV issue?

Whenever I execute the following korn shell script command I get this error. su - feeduser export: =0: not identifier ** Here is the part of the script with the error ** # Set db type (PRODUCTION, DEVELOPMENT, QA, UA) # unset DB_TYPE_ERROR $HOME/share/$DBS_NAME $ORACLE_SID... (3 Replies)
Discussion started by: soupbone38
3 Replies

8. AIX

edit env. setting

hi eveybody, i m trying to set acl using acledit command in AIX box but wat im gettung is 3002-100 acledit: EDITOR environment variable not set can anyone help me out how 2 set editor.................... thanks in advance (4 Replies)
Discussion started by: rrlog
4 Replies

9. Shell Programming and Scripting

Some env setting is causing the script not to work ?

Not sure what has changed in the Unix environment. The following script which was working is now not working. #!/usr/bin/ksh # ----------------------------------------------------------------------------- # File: monitor_db.sh # #... (1 Reply)
Discussion started by: uuser
1 Replies

10. Solaris

setting env

I am trying to set up my compiler, but when I go to look for gcc it not found but I get a message that stayed (/usr/oasys/bin) and when I go into the dir to set my env the following is type cp : cannot creat //pref/.environ: no such file or directory and I input ./setenv PATH=... (3 Replies)
Discussion started by: alsande
3 Replies
Login or Register to Ask a Question