Sponsored Content
Top Forums Shell Programming and Scripting Executing unix script on windows through MKSToolkit Post 302278519 by ammu on Tuesday 20th of January 2009 12:04:45 PM
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!
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
script(1)							   User Commands							 script(1)

NAME
script - make record of a terminal session SYNOPSIS
script [-a] [filename] DESCRIPTION
The script utility makes a record of everything printed on your screen. The record is written to filename. If no file name is given, the record is saved in the file typescript. See WARNINGS. The script command forks and creates a sub-shell, according to the value of $SHELL, and records the text from this session. The script ends when the forked shell exits or when Control-d is typed. OPTIONS
The following option is supported: -a Appends the session record to filename, rather than overwriting it. NOTES
script places everything that appears on the screen in filename, including prompts. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |CSI |Enabled | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5) WARNINGS
script can pose a security risk when used in directories that are writable by other users (for example, /tmp), especially when run by a privileged user, that is, root. Be sure that typescript is not a link before running script. SunOS 5.11 30 Jan 2004 script(1)
All times are GMT -4. The time now is 05:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy