Avatar of elwayisgod
elwayisgodFlag for United States of America

asked on 

Passing variables into Korn Shell or setting up variable - HELP!!!

I need to set up some Environment Variables in ksh.  Note I'm on Windows using MKS Toolkit.   I have a file named 'setenv.ksh' that is:

hyp_home_drive=F:
hyp_batch_path=\Hyperion\batch
essUserID=admin
esspassword=password
essserver=sdndheb2

ess_bin_source=F:\Hyperion\Essbase\bin
ess_bin_bkup=F:\EssbaseBackup\Daily\EssbaseFiles
ess_bkup_daily=F:\EssbaseBackup\Daily
ess_bkup_daily_ksh=F:/EssbaseBackup/Daily
ess_bkup_logs=F:\EssbaseBackupLogs
ess_bkup_logs_ksh=F:/EssbaseBackupLogs
ess_log_source=F:\Hyperion\Essbase
ess_log_bkup=F:\EssbaseBackup\Daily\EssbaseFiles
ess_ssaudit_source=F:\EssbaseBackup\SSAUDIT
ess_ssaudit_bkup=F:\EssbaseBackup\Daily\SSAUDIT
ess_app_dir_source=F:\Hyperion\essbase\app
ess_app_dir_source_ksh=F:/Hyperion/essbase/app
ess_app_dir_bkup=F:\EssbaseBackup\Daily\App
ess_scripts_bkup=F:\Hyperion\essbase\scripts\maxl
ess_bkup_dir=F:/EssbaseBackup

Then in my .bat file, I'm trying to call it so it sets these variable for the ksh peices of my code.  However it does not set these variables.  I need the last lines to call the setenv.ksh file and set the variable for the rest of the script.  Here is my .bat file.

echo. |time > DailyBackupStartTime

REM Set the Environment Variables for this script
REM DO NOT SETENV.CMD with variables for the below. Keep it hardcoded F:\Hyperion\essbase\scripts\maxl\setenv.cmd
       
        call F:\Hyperion\essbase\scripts\maxl\setenv.cmd


REM Step 1 Logout all users, shutdown service, and delete current contents of folders
     
    erase %ess_bkup_logs%\*.* /S/Q/F
    REM > %ess_bkup_logs%\Step_1A.txt (All the files overwrite existing, thus no need for this line)
   
REM Delete the 'App' directory in backup location as it will be refreshed in Step_6 below

      rmdir %ess_app_dir_bkup%\"."/S/Q >> %ess_bkup_logs%\Step_1A.txt
     
REM Set the Environment Variables for the Korn Shell

      cd %ess_app_dir_source%\
      ksh.exe ./setenv.ksh
     

**********************************************

Note:  The 'call' statement sets the same variable in the windows batch scripting portion and is working properly.  thus the issue, I need the ksh part to set them too for that part.

Then when I run it, it's passing the wrong password '3ssb@s3' and server 'sdntheb2'.  Instead of 'password' and 'sdndheb2'.  I have no idea how the wrong variable is getting passed into here or where it came from.

MAX> login admin 3ssb@s3 on sdntheb2;

System Programming

Avatar of undefined
Last Comment
yuzh
ASKER CERTIFIED SOLUTION
Avatar of yuzh
yuzh

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of elwayisgod
elwayisgod
Flag of United States of America image

ASKER

so if the path in Windows is:  F:\Hyperion\Essbase\App

then it becomes:

./F:/Hyperion/essbase/app/setenv.ksh

???  that does not work however
Avatar of elwayisgod
elwayisgod
Flag of United States of America image

ASKER

Heres my script.  Am I on the right path?

#!/bin/ksh
./F:\hyperion\essbase\app\setenv.ksh

# First remove the existing 'DailyLogout.bat' file as it needs to recreate every run
rm $ess_scripts_bkup/DailyLogout.bat

# Now recreate a empty DailyLogout.bat file
touch $ess_scripts_bkup/DailyLogout.bat

# Start building the DailyLogout.bat file dynamically, start with login
echo "login $essUserID $esspassword on $essserver;\n\n" >> $ess_scripts_bkup/DailyLogout.bat

# remove existing logfile Step_1.txt then create a empty one
rm $ess_bkup_logs_ksh/Step_1.txt
touch $ess_bkup_logs_ksh/Step_1.txt

# Specify where to store the new Step_1.txt log file
echo "spool on to '$ess_bkup_logs_ksh/Step_1.txt';\n\n" >> $ess_scripts_bkup/DailyLogout.bat

# Build the logout command line to Logout All users. No need for dynamic build here

echo "alter system logout session all;" >> $ess_scripts_bkup/DailyLogout.bat


# Build the exit line
echo "exit;" >> $ess_scripts_bkup/DailyLogout.bat
Avatar of yuzh
yuzh

A DOT + SPACE + /path-to/setenv.ksh

You forgot a SPACE !
System Programming
System Programming

Kernel and system programming is the process of creating the software necessary for a computer or device to function and operate other programs. Some operating systems (such as Microsoft Windows) are proprietary, but others, such as the various Linux distributions, are open source.

41K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo