Sponsored Content
Top Forums Shell Programming and Scripting how to call a .bat file using KSH Post 302275089 by bhagya2340 on Friday 9th of January 2009 08:35:27 AM
Old 01-09-2009
Thanks!

I am sorry for not being clear...Well we dont have Cygwin and i dont i can get that also....

Actually the unix box and windows (windows XP Sp2, MS office 2003) are on different servers (I think so). I wrote a script to FTP a file form windows to unix and its working...

Code:
STEP_NUM="30"
STEP_NAME="FTP Files "
Log_Step_Begin
FTP_FILE_NAME="LTC*.csv"
FTP_DIR_NAME="ProviderReject"
ONE_MORE="Notification_Reports"
PRESENT_DIR=`pwd`
FTP_STATS="${LOG_DIR}/FTP_Provider_Rej.stats"
FTP_ERR="${LOG_DIR}/FTP_Provider_Rej.error"
ftp -nv ${SI_NOTIFICATION_FTP_IP} > ${FTP_STATS} 2> ${FTP_ERR} <<EOF 
user ${SI_NOTIFICATION_FTP_USER} ${SI_NOTIFICATION_FTP_PASSWORD}
cd ${ONE_MORE}
cd ${FTP_DIR_NAME} 
bin
lcd ${DATA_DIR}
pwd
dir
prompt off
mget ${FTP_FILE_NAME}  
mdelete ${FTP_FILE_NAME}
prompt on
dir
EOF
if [[ -f $FTP_ERR ]] && [[ ! -s $FTP_ERR ]]     
then                                            
  rm -f ${FTP_ERR}                              
fi                                              
CURRENT_DIR=`pwd`
echo 1
echo $`pwd`
cd ${DATA_DIR}
echo 2
echo $`pwd`
FTP_FILE_NAME=`ls | grep $FTP_FILE_NAME` 
UNIX_FILE_NAME="${FTP_FILE_NAME%.*}".dat
echo 3
echo $`pwd`
cd $CURRENT_DIR
echo 4
echo $`pwd`
if [[ ! -f ${DATA_DIR}/${FTP_FILE_NAME} ]]     
then
     print "\n FILE NOT  FOUND ! \n" >> ${SCRIPT_LOG_FILE}
     SUBJ="${SCRIPT_NAME} CSV FILE  NOT FOUND for ${CUR_MAINT_DATE}"
     MSG="File Not found .  Runtime=$(Elapsed_Time ${START_TIME})"
     echo "${MSG}" | mailx -s"${SCRIPT_RUN_ENV} - ${SUBJ}" `cat ${ANALYST_EMAIL_FILE}`
       
     if [ ! -d ${LOG_DIR}/${CUR_MAINT_DATE} ]  
     then                                       
       mkdir ${LOG_DIR}/${CUR_MAINT_DATE}     
     fi                                         
      mv -f ${SCRIPT_LOG_FILE} ${LOG_DIR}/${CUR_MAINT_DATE}
     exit 0
fi


Actually now i want add somemore to this script.... Before this script start i manually generate a LTC*.cvs on windows then run this script to ftp the .cvs file to unixbox.... Now i have decied to put it on cron so it automatically does the work at sheduled time.
On windows i have a maro that converts a .xls file into .cvs... which i run using a .bat and .vbs files... when i double click .bat file it asks me to select the file i want to convert into .cvs file and it converts. it save the converted file in a folder from where the unix script ftp the file.
I to make this manually work automaited i have to either convert the .xls file using unix script or using unix script to trigger .bat file....
I hope you understood what actually i want to do....Please sugesst me

Thanks!
Bhagya
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

possibility to call subprocesses from ksh ??

Hi!! Is there a possibility to call/start a subproces using ksh ?? Hope that there is somebody to help me. thanks in advance. Corine (3 Replies)
Discussion started by: TheBlueLady
3 Replies

2. Windows & DOS: Issues & Discussions

converting ksh scripts--.bat in window's

hi evry one , I did some ksh scripts for file editing in AIX 5.2 ver, issue is while I was trying to run these scripts in windows box as batch files windows is not recognising the awk part of the ksh script,as it is GNU environment, so any one who can help me will be appreciated. this is the... (3 Replies)
Discussion started by: 2.5lt V8
3 Replies

3. Windows & DOS: Issues & Discussions

one question for .bat file

Hi! I'm very sorry for such simple and silly question but I cannot answer it by myself. Can you please help me? In .bat file I should run the C program which is in other directory, and the input configuration file is in this directory too. This dir name is in dirRun variable. The... (3 Replies)
Discussion started by: Anta
3 Replies

4. Shell Programming and Scripting

Not getting the out value parameter of a DB call in the ksh file

Hi all Im calling a DB procedure as foll sqlplus -s $DB_USERID/$DB_PASSWD@$DB_NAME<<eof var var1 VARCHAR2(200); exec ODAS_BATCH_JOBS_RETRIEVE.retrieve_user_info(:var1); eof echo $var1 This echo is giving a blank. Also in case the package ODAS_BATCH_JOBS_RETRIEVE is in an un compiled... (2 Replies)
Discussion started by: Sam123
2 Replies

5. Windows & DOS: Issues & Discussions

Can rsh command be used to call a bat file

I have a .bat file on windows, which converts a .xls file into .csv file and using a ksh script i would usually FTP this .csv file... Now i want to trigger this .bat form my ksh script. can i use rsh command in my FTP to run .bat file on windows and then ftp the generated .csv file...is... (19 Replies)
Discussion started by: bhagya2340
19 Replies

6. Shell Programming and Scripting

Simple bat file

Hi guys, I need a *.bat to run a ksh file in the shell on Windows NT...nothing more :) How do I do it? I tried with the following but it failed: set INFORMIXDIR=D:\user-applications\informix set PATH=%INFORMIXDIR%;%PATH% D:\user-applications\MKS\mksnt\sh.exe C:\hk_9.2\C3_weekly_auto.ksh... (4 Replies)
Discussion started by: Dird
4 Replies

7. Shell Programming and Scripting

HELP. Oracle Call from ksh script

I have searched the forums and couldn't find my specific issue so I figure that I would post on it. I am trying to run a simple sql script that spools to a flat file from a unix script. I have tried to make the call outright from inside of the ksh script as such: sqlplus... (3 Replies)
Discussion started by: BkontheShell718
3 Replies

8. Windows & DOS: Issues & Discussions

Executing .bat file

Hi , I have a bat file on windows machine ,I need to excute it from my local unix machine using sambe utility.Is there any comman to execute the .bat file remotely. Using samba utility i can post files to and fro from windows to unix but i don't comman to exute the .bat file. can any one... (2 Replies)
Discussion started by: Raamc
2 Replies

9. Shell Programming and Scripting

Need help with bat file!!!

I need to put/get files from Windows machine to Unix machine and vice-versa. I wrote a text file "ftp1.txt" as below. naga naga06 cd /root/Naga prom off get time.unl bye I wrote another bat file "ftp.bat" as below. ftp -n -s:C:\Users\Naga\Desktop\ftp1.txt IP_ADDRESS but... (2 Replies)
Discussion started by: Naga06
2 Replies

10. Shell Programming and Scripting

Not able to call an element from an array in ksh

Hi, I have: # Initialize variables #!/usr/bin/ksh FILENM=$1 INDEX=0 # read filename echo "You are working with the Config file: $FILENM" while read line do echo $line data=$line ((INDEX=INDEX+1)) done <"$FILENM" (3 Replies)
Discussion started by: Marc G
3 Replies
suspend(1)                                                         User Commands                                                        suspend(1)

NAME
suspend - shell built-in function to halt the current shell SYNOPSIS
sh suspend csh suspend ksh suspend DESCRIPTION
sh Stops the execution of the current shell (but not if it is the login shell). csh Stop the shell in its tracks, much as if it had been sent a stop signal with ^Z. This is most often used to stop shells started by su. ksh Stops the execution of the current shell (but not if it is the login shell). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), kill(1), ksh(1), sh(1), su(1M), attributes(5) SunOS 5.10 15 Apr 1994 suspend(1)
All times are GMT -4. The time now is 09:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy