Windows batch script not running in Control-M -
recently have written windows batch script downloading files sftp location. have used command scpg3 provided ssh tectia software purpose. script runs fine without errors when manually run or when scheduled through windows task scheduler.
but real problem comes when script scheduled in control-m. script stops executing @ command scpg3. command meant connecting sftp location , downloading required files.
@echo off if "%os%" == "windows_nt" setlocal enabledelayedexpansion enableextensions set ics_current_directory=f:/scbutility/icsinterface set count=0 set nullcount=0 /f "tokens=1* delims==" %%a in (%ics_current_directory%/icssymphonydailyjob.properties) ( if "%%a"=="symphony_zip_download_drive" set symphony_zip_download_drive=%%b if "%%a"=="symphony_zip_download_location" set symphony_zip_download_location=%%b if "%%a"=="symphony_download_sftp_url" set symphony_download_sftp_url=%%b if "%%a"=="symphony_dowmload_path" set symphony_dowmload_path=%%b if "%%a"=="symphony_log_file" set symphony_log_file=%%b if "%%a"=="symphony_download_file_format" set symphony_download_file_format=%%b if "%%a"=="symphony_file_pattern" set symphony_file_pattern=%%b if "%%a"=="symphony_files_download_frequency" set symphony_files_download_frequency=%%b if "%%a"=="symphony_rekon_file" set symphony_rekon_file=%%b ) echo %date% %time% -----------------------------extracting symphony zip files sftp location---------------------- >> %symphony_log_file% %symphony_zip_download_drive%: if not exist "%symphony_zip_download_location%" mkdir "%symphony_zip_download_location%" set current_dir=%symphony_zip_download_location% cd %current_dir% set x=%symphony_files_download_frequency% set i=-1 /l %%a in (1,1,%x%) ( set /a i=!i!+1 call:mydatefunc %i% ) call :filecounter %symphony_zip_download_location% if %count% neq %nullcount% ( call %ics_current_directory%/symphony_archive.cmd call %ics_current_directory%/symphony_temp_move.cmd goto :eof ) else ( echo no files available download. echo %date% %time% no symphony files available download >> %symphony_rekon_file% echo %date% %time% no symphony files available download >> %symphony_log_file% exit /b %errorlevel% ) :filecounter echo %symphony_zip_download_location% %%a in (""%symphony_zip_download_location%\*.zip"") set /a count+=1 echo no of symphony zip files downloaded:: %count% echo %date% %time%: no of symphony zip files downloaded sftp location: %count% >> %symphony_rekon_file% echo %date% %time%: no of symphony zip files downloaded sftp location: %count% >> %symphony_log_file% goto :eof :mydatefunc /f %%a in ('"powershell [datetime]::now.adddays(-%i%).tostring('yyyy-mm-dd')"') ( echo %date% %time% : checking zips date : %%a >> %symphony_log_file% scpg3 -p >> %symphony_log_file% %symphony_download_sftp_url%:%symphony_dowmload_path%%symphony_file_pattern%%%a_%symphony_download_file_format% %symphony_zip_download_location% echo %date% %time% : connection sftp location successfull!! >> %symphony_log_file% echo connection sftp location successfull!! if %errorlevel% equ 0 ( echo %errorlevel% echo downloading zips date : %%a echo %date% %time% : downloaded zips on date : %%a >> %symphony_log_file% ) else ( echo %errorlevel% echo no zips avialable downloading on date : %%a echo %date% %time% : no zips avialable downloading on date : %%a >> %symphony_log_file% ) ) exit /b %errorlevel% the script stops on reaching command line:
scpg3 -p >> %symphony_log_file% %symphony_download_sftp_url%:%symphony_dowmload_path%%symphony_file_pattern%%%a_%symphony_download_file_format% %symphony_zip_download_location% even usage of command line full file name of scpg3 not solve problem:
"c:\program files (x86)\ssh communications security\ssh tectia\ssh tectia client\scpg3.exe" -p >> %symphony_log_file% %symphony_download_sftp_url%:%symphony_dowmload_path%%symphony_file_pattern%%%a_%symphony_download_file_format% %symphony_zip_download_location% i have provided required security permissions.
can me navigate trough issue?
Comments
Post a Comment