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
stopped(7)						 Miscellaneous Information Manual						stopped(7)

NAME
stopped - event signalling that a job has stopped SYNOPSIS
stopped JOB=JOB INSTANCE=INSTANCE RESULT=RESULT [PROCESS=PROCESS] [EXIT_STATUS=STATUS] [EXIT_SIGNAL=SIGNAL] [ENV]... DESCRIPTION
The stopped event is generated by the Upstart init(8) daemon when an instance of a job has stopped. The JOB environment variable contains the job name, and the INSTANCE environment variable contains the instance name which will be empty for single-instance jobs. If the job was stopped normally, the RESULT environment variable will be ok, otherwise if the job was stopped because it has failed it will be failed. When the job has failed, the process that failed will be given in the PROCESS environment variable. This may be pre-start, post-start, main, pre-stop or post-stop; it may also be the special value respawn to indicate that the job was stopped because it hit the respawn limit. Finally in the case of a failed job, one of either EXIT_STATUS or EXIT_SIGNAL may be given to indicate the cause of the stop. Either EXIT_STATUS will contain the exit status code of the process, or EXIT_SIGNAL will contain the name of the signal that the process received. The normal exit job configuration stanza can be used to prevent particular exit status values or signals resulting in a failed job, see init(5) for more information. If neither EXIT_STATUS or EXIT_SIGNAL is given for a failed process, it is because the process failed to spawn (for example, file not found). See the system logs for the error. init(8) emits this event as an informational signal, services and tasks started or stopped by this event will do so in parallel with other activity. It is typically combined with the starting(7) event by services when inserting themselves as a dependency. Job configuration files may use the export stanza to export environment variables from their own environment into the stopped event. See init(5) for more details. EXAMPLE
A service that wishes to be running whenever another service would be running, started before and stopped after it, might use: start on starting apache stop on stopped apache A task that must be run after another task or service has been stopped might use: start on stopped postgresql SEE ALSO
starting(7) started(7) stopping(7) init(5) Upstart 2009-07-09 stopped(7)
All times are GMT -4. The time now is 11:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy