Automatic Synchronitzation

Advertisement

Maik
Guest

Automatic Synchronitzation

It's possible to create a Scheduled task to make a daily synchronitzation between two servers. Can I call the soft via cmd?

Reply with quote

Advertisement

Guest

Re: Automatic Synchronitzation

Maik wrote:

It's possible to create a Scheduled task to make a daily synchronitzation between two servers. Can I call the soft via cmd?

It took some time to figure the best way out.
Install WinSCP en make a connection to the Unix server to receive the hash keys.
Copy the keys to the profile of the account which runs the scheduler or copy them to the default profile.

Then you can use the following vbs script and bat script. Call the vbs from the scheduler and it synchronise the local folder with the remote one.
You can moify the script is an other synchonisation way is needed.
Note: if you use linked files on the Unix server which shows a small file, but are big files in size, the data transfer drops to 30Kb/s.


anyname.VBS
---------------------------------------------------------------------------------------
Const BatchFilePath = "C:\batch\"
Const WinSCPAppPath = "C:\Progra~1\WinSCP3\winscp3.com"
Const ConnectionUserName = "username"
Const ConnectionPassword = "password"
Const WinSCPParam = " option confirm off /script="

Dim shell : Set shell = wscript.CreateObject("WScript.Shell")
Dim objFSO : set objFSO = createObject("scripting.filesystemObject")
Dim objNet : Set objNet = CreateObject("wscript.network")
Dim ArgObj : Set ArgObj = WScript.Arguments
Dim CommandLine

ServerName = ArgObj(0)
ScriptName = "scriptname.bat"

Set textFile = objFSO.OpentextFile("C:\Synchonizelog.txt",2 ,true)

TextFile.writeLine("Start" & " " & Now & " By " & objNet.UserName)

CommandLine = WinSCPAppPath & " " & ConnectionUserName & ":" & ConnectionPassword & "@" & ServerName & WinSCPParam & BatchFilePath & ScriptName

shell.Run CommandLine,0 ,true

TextFile.writeLine("Finished" & " " & Now)

textfile.close

set ArgObj = Nothing
set objNet = Nothing
set objFSO = nothing
set shell = nothing
---------------------------------------------------------------------------------------

scriptname.BAT
---------------------------------------------------------------------------------------
option confirm off
synchronize local C:\logfiles\folder /application/logs/
close
exit
---------------------------------------------------------------------------------------

Reply with quote

Advertisement

You can post new topics in this forum