Executing unix script on windows through MKSToolkit


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Executing unix script on windows through MKSToolkit
# 1  
Old 01-16-2009
Executing unix script on windows through MKSToolkit

hi,

I have an unix script and i'm executing from command prompt in windows.
The script is exiting immediately when i call the script.But the script is getting executed at the back end.

But when i type sh at command prompt i'm getting $ sign and i can see the execution of script.

Is there any way to modify my script to wait until completion of the process and then exit.

Also is there any problem when trying to call d:\script\a.ksh from C:\

Please advice!
# 2  
Old 01-16-2009
Question Perhaps....

you could add the following line to your unix script

Code:
echo "press enter to continue"; read ans

Which would cause the script to wait until your press the ENTER key.
# 3  
Old 01-16-2009
Is there any other method instead of manually entering the key. This script is used for scheduling purpose.
# 4  
Old 01-20-2009
Data

Any ideas about doing this. Please advice!
# 5  
Old 01-20-2009
Unless we see your script and what it is doing, we really cannot help you. You simply have not provided enough information.
# 6  
Old 01-20-2009
Hi,

This is my script.

#!/usr/bin/sh

PROG=`basename ${0}`
EXIT_STATUS=0
NOW=`date`
echo "${NOW} ${PROG} Initialization..."
DSHOME=C:/IBM/InformationServer/Server/DSEngine
FILE_NAME=`basename $0 .ksh`
DSPROJNAME=PROJ_DEV
DSJOBNAME=`basename $0 .ksh`
BinFileDirectory=$DSHOME/bin
DSLOG="DS_"$DSJOBNAME
DSLOG_FILE=C:/projects/log/$DSLOG.log
DT_START=`date`
echo "-----------------------------------------">>$DSLOG_FILE
echo "${NOW} ${PROG} : Execution Started at for Datastage Job Sequencer:" $DSJOBNAME " on date:$DT_START">>$DSLOG_FILE

################################################################################
# Execute job here
################################################################################
echo "${NOW} ${PROG} : ${BinFileDirectory}/dsjob.exe -user user1 -password password -server server -run -jobstatus -wait $ParamList $DSPROJNAME $DSJOBNAME" >> $DSLOG_FILE
RETURN_VALUE=$?
case $RETURN_VALUE in
1|2)
echo "${NOW} ${PROG} : Job $DSJOBNAME completed successfully " >>$DSLOG_FILE
EXIT_STATUS=0
;;
0)
echo "${NOW} ${PROG} : Error: $DSJOBNAME job failed. error code was -ALREADY RUNNING- Code $RETURN_VALUE" >> $DSLOG_FILE
EXIT_STATUS=99
;;
3|96)
echo "${NOW} ${PROG} : Error: $DSJOBNAME job failed. error code was -ABORT- Code $RETURN_VALUE" >> $DSLOG_FILE
EXIT_STATUS=$RETURN_VALUE
;;
8|13)
echo "${NOW} ${PROG} : Error: $DSJOBNAME job failed. error code was -Failed Validation- Code $RETURN_VALUE" >> $DSLOG_FILE
EXIT_STATUS=$RETURN_VALUE
;;
97)
echo "${NOW} ${PROG} : Error: $DSJOBNAME job failed. error code was -Stopped- Code $RETURN_VALUE" >> $DSLOG_FILE
EXIT_STATUS=$RETURN_VALUE
;;
9)
echo "${NOW} ${PROG} : Error: $DSJOBNAME job failed. error code was -Not Compiled- Code $RETURN_VALUE" >> $DSLOG_FILE
EXIT_STATUS=$RETURN_VALUE
;;
*)
echo "${NOW} ${PROG} : Error: $DSJOBNAME job failed. error code was $RETURN_VALUE" >> $DSLOG_FILE
EXIT_STATUS=$RETURN_VALUE
;;
esac

if [ ${EXIT_STATUS} -ne 0 ]
then
echo "${NOW} ${PROG} : Error in the Shell for calling the Datastage job sequencer:" $DSJOBNAME >>$DSLOG_FILE

else
echo "${NOW} ${PROG} : Successfully executed the Shell for calling the Datastage job sequencer:" $DSJOBNAME >>$DSLOG_FILE
fi
DT_END=`date`
echo "${NOW} ${PROG} : Execution Ended on $DT_END with Shell Status as :"$EXIT_STATUS>>$DSLOG_FILE

echo "--------------------------------------------">>$DSLOG_FILE

exit ${EXIT_STATUS}

Thanks!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Executing of UNIX script using email

Dear Unix Leads, can you please let me know is it possible to execute a shell script in UNIX machine sending an email from outlook or gmail ? or is it possible to generate a token file in UNIX by sending email which we can indirectly use to trigger script your response on this is highly... (5 Replies)
Discussion started by: mirwasim
5 Replies

2. Shell Programming and Scripting

Executing java .jar from UNIX script

I have a .jar placed in my Unix directory. The .jar creates a .csv file .I want to execute the .jar and place the output file in a target Unix directory. The Unix Script is as follows. The issue that i am facing is that the file is not being placed in the REPORTDIR=/cdunix/IQNavigator/wrk instead... (4 Replies)
Discussion started by: pankajkargeti12
4 Replies

3. Shell Programming and Scripting

sh script to get unix username of person executing it

Hi, I am writing a script, and I need to incorporate some logic where I can find out the unix username of the person who is executing the script. The issue is , a particular user could have "sesu" ed into a group id. for eg. root, and then executed the script. In that case, instead of root,... (5 Replies)
Discussion started by: neil.k
5 Replies

4. UNIX for Advanced & Expert Users

Executing a shell script from windows;script present in unix

I need to execute a shell script kept in unix machine from windows. User id, password area available. For eg. There's a shell script wich moves all the logs kept in my home directory to a directory named LOGS. Now i need to get this done through windows; either using a batch file, or java... (4 Replies)
Discussion started by: rajneesh_kapoor
4 Replies

5. UNIX for Advanced & Expert Users

Executing shell script from Windows FTP

Hello, Any inputs on the possibility of executing a shell script on unix box from Windows FTP TIA (1 Reply)
Discussion started by: B2BIntegrator
1 Replies

6. Shell Programming and Scripting

Executing Windows batch file from UNIX

Hi everyone, let me get straight to the points. My manager wants to execute a remote batch file (on a Windows server) from a UNIX Machine, does anyone know if this is possible and what packages would be needed? Thanks p.s. Sorry i cant give OS specifics, we use most UNIX's; AIX, Solaris,... (5 Replies)
Discussion started by: flip387
5 Replies

7. UNIX for Dummies Questions & Answers

Executing application on Windows from Unix machine

I have two machines, one running Windows and another one Unix over a network. I want to execute a batch file on the Windows machine using a script running on the Unix machine. I have tried creating a rsa key and transferrring it to the destination machine but it doesn't work. The purpose was to... (3 Replies)
Discussion started by: MobileUser
3 Replies

8. UNIX for Advanced & Expert Users

Executing a .dll from a Unix script

Is it possible for a Unix script to execute a .dll. If so, where would I find information/examples of how to do that? Thanks, in advance, for any help. :rolleyes: (2 Replies)
Discussion started by: BCarlson
2 Replies

9. Shell Programming and Scripting

executing *.bat file on windows from Unix box via ftp command

I have created get_list.bat file containing following line: dir /B /O-d >file_list.txt I am executing ftp command from Unix box and transferring get_list.bat file to windows server. In my next ftp command I am trying to execute this test.bat file by entering this line: get_list or by... (9 Replies)
Discussion started by: alx
9 Replies

10. UNIX for Advanced & Expert Users

executing applications/commands on a unix server from a windows PC

i have a network drive (samba) mounted on to my PC and also i have SSH client on my machine. however i need to run applications/commands on a unix server from the middle of a different executable(windows compatable one). so i need to connect to the unix server from SSH through the... (1 Reply)
Discussion started by: megastar
1 Replies
Login or Register to Ask a Question