Automate script using synchronization

Advertisement

mttime73
Joined:
Posts:
1

Automate script using synchronization

Hello,
I am a newbie and trying to setup an automated script that will run WinSCP from a local server I'm logged into and then copy a daily backup file to a remote server running OpenSSH.

I have setup a script, backup.txt:
option batch on
option confirm off
open PS-HOST
synchronize local "C:\SVNBackup\" "/cygdrive/d/SVN/"
exit


I then run the script using a batch command, backup.bat:
winscp.exe /console /script=C:\Users\Administrator\Desktop\VisualSVN\backup.txt /log=C:\Users\Administrator\Desktop\VisualSVN\backuplog.txt

However, after running the files I expected to see in the remote directory aren't there. Here is an excerpt from the log:
2013-03-31 15:16:14.007 Changing directory to "/cygdrive/d/SVN".
. 2013-03-31 15:16:14.007 Getting real path for '/cygdrive/d/SVN'
. 2013-03-31 15:16:14.131 Real path is '/cygdrive/d/SVN'
. 2013-03-31 15:16:14.131 Trying to open directory "/cygdrive/d/SVN".
> 2013-03-31 15:16:14.131 Type: SSH_FXP_LSTAT, Size: 24, Number: 263
< 2013-03-31 15:16:14.257 Type: SSH_FXP_ATTRS, Size: 37, Number: 263
. 2013-03-31 15:16:14.257 Getting current directory name.
. 2013-03-31 15:16:14.257 Startup conversation with host finished.
< 2013-03-31 15:16:14.257 Script: Active session: [1] PS-HOST
> 2013-03-31 15:16:14.257 Script: synchronize local "C:\SVNBackup\" "/cygdrive/d/SVN/"
< 2013-03-31 15:16:14.258 Script: Comparing...
. 2013-03-31 15:16:14.258 Collecting synchronization list for local directory 'C:\SVNBackup\' and remote directory '/cygdrive/d/SVN/', mode = 1, params = 2
. 2013-03-31 15:16:14.273 Local file 'C:\SVNBackup\.' [2013-03-31T20:43:03.699Z] [0] excluded from synchronization
. 2013-03-31 15:16:14.273 Local file 'C:\SVNBackup\..' [2013-03-31T20:43:03.699Z] [0] excluded from synchronization
. 2013-03-31 15:16:14.274 Local file 'C:\SVNBackup\2012-10-06repoTP.dump' [2012-10-06T23:47:32.414Z] [634817069] included to synchronization
. 2013-03-31 15:16:14.274 Local file 'C:\SVNBackup\2013-03-20repoTP.dump' [2013-03-21T05:25:05.839Z] [639154515] included to synchronization
. 2013-03-31 15:16:14.274 Local file 'C:\SVNBackup\2013-03-23repoTP.dump' [2013-03-23T23:29:40.753Z] [639154515] included to synchronization
. 2013-03-31 15:16:14.274 Local file 'C:\SVNBackup\2013-03-24repoTP.dump' [2013-03-24T09:01:34.300Z] [639154515] included to synchronization
. 2013-03-31 15:16:14.274 Local file 'C:\SVNBackup\2013-03-25repoTP.dump' [2013-03-25T09:01:22.111Z] [639154515] included to synchronization
. 2013-03-31 15:16:14.274 Local file 'C:\SVNBackup\2013-03-26repoTP.dump' [2013-03-26T09:01:05.064Z] [641258628] included to synchronization
. 2013-03-31 15:16:14.274 Local file 'C:\SVNBackup\2013-03-27repoTP.dump' [2013-03-27T09:01:03.782Z] [641258628] included to synchronization
. 2013-03-31 15:16:14.274 Local file 'C:\SVNBackup\2013-03-28repoTP.dump' [2013-03-28T09:01:19.292Z] [642210787] included to synchronization
. 2013-03-31 15:16:14.274 Local file 'C:\SVNBackup\2013-03-29repoTP.dump' [2013-03-29T09:01:10.273Z] [642210787] included to synchronization
. 2013-03-31 15:16:14.274 Local file 'C:\SVNBackup\2013-03-30repoTP.dump' [2013-03-30T09:01:10.625Z] [642210787] included to synchronization
. 2013-03-31 15:16:14.274 Local file 'C:\SVNBackup\2013-03-31repoTP.dump' [2013-03-31T09:01:49.423Z] [642210787] included to synchronization
. 2013-03-31 15:16:14.274 Listing directory "/cygdrive/d/SVN".
> 2013-03-31 15:16:14.274 Type: SSH_FXP_OPENDIR, Size: 24, Number: 523
< 2013-03-31 15:16:14.396 Type: SSH_FXP_HANDLE, Size: 13, Number: 523
> 2013-03-31 15:16:14.396 Type: SSH_FXP_READDIR, Size: 13, Number: 780
< 2013-03-31 15:16:14.523 Type: SSH_FXP_NAME, Size: 658, Number: 780
> 2013-03-31 15:16:14.523 Type: SSH_FXP_READDIR, Size: 13, Number: 1036
< 2013-03-31 15:16:14.646 Type: SSH_FXP_STATUS, Size: 28, Number: 1036
< 2013-03-31 15:16:14.646 Status code: 1
> 2013-03-31 15:16:14.646 Type: SSH_FXP_CLOSE, Size: 13, Number: 1284
. 2013-03-31 15:16:14.648 Remote file '/cygdrive/d/SVN/VisualSVN-Server-2.5.6.msi' [2012-10-02T00:54:33.000Z] [4780032] is new
. 2013-03-31 15:16:14.648 Local file 'C:\SVNBackup\2012-10-06repoTP.dump' [2012-10-06T23:47:32.414Z] [634817069] is new
. 2013-03-31 15:16:14.648 Local file 'C:\SVNBackup\2013-03-23repoTP.dump' [2013-03-23T23:29:40.753Z] [639154515] is new
. 2013-03-31 15:16:14.648 Local file 'C:\SVNBackup\2013-03-24repoTP.dump' [2013-03-24T09:01:34.300Z] [639154515] is new
. 2013-03-31 15:16:14.648 Local file 'C:\SVNBackup\2013-03-25repoTP.dump' [2013-03-25T09:01:22.111Z] [639154515] is new
. 2013-03-31 15:16:14.648 Local file 'C:\SVNBackup\2013-03-26repoTP.dump' [2013-03-26T09:01:05.064Z] [641258628] is new
. 2013-03-31 15:16:14.648 Local file 'C:\SVNBackup\2013-03-27repoTP.dump' [2013-03-27T09:01:03.782Z] [641258628] is new
. 2013-03-31 15:16:14.648 Local file 'C:\SVNBackup\2013-03-28repoTP.dump' [2013-03-28T09:01:19.292Z] [642210787] is new
. 2013-03-31 15:16:14.648 Local file 'C:\SVNBackup\2013-03-29repoTP.dump' [2013-03-29T09:01:10.273Z] [642210787] is new
. 2013-03-31 15:16:14.648 Local file 'C:\SVNBackup\2013-03-31repoTP.dump' [2013-03-31T09:01:49.423Z] [642210787] is new
< 2013-03-31 15:16:14.648 Script: Synchronizing...
. 2013-03-31 15:16:14.649 Synchronizing local directory 'C:\SVNBackup\' with remote directory '/cygdrive/d/SVN/', params = 2
. 2013-03-31 15:16:14.663 File: "/cygdrive/d/SVN/VisualSVN-Server-2.5.6.msi"
< 2013-03-31 15:16:14.663 Script: Local 'C:\SVNBackup' <= Remote '/cygdrive/d/SVN'
. 2013-03-31 15:16:14.663 Copying "/cygdrive/d/SVN/VisualSVN-Server-2.5.6.msi" to local directory started.
. 2013-03-31 15:16:14.663 Binary transfer mode selected.
. 2013-03-31 15:16:14.663 Checking existence of partially transfered file.
. 2013-03-31 15:16:14.663 Opening remote file.
> 2013-03-31 15:16:14.663 Type: SSH_FXP_OPEN, Size: 59, Number: 1539
< 2013-03-31 15:16:14.770 Type: SSH_FXP_STATUS, Size: 24, Number: 1284
. 2013-03-31 15:16:14.770 Discarding reserved response
< 2013-03-31 15:16:14.895 Type: SSH_FXP_HANDLE, Size: 13, Number: 1539
> 2013-03-31 15:16:14.895 Type: SSH_FXP_FSTAT, Size: 13, Number: 1800
< 2013-03-31 15:16:15.021 Type: SSH_FXP_ATTRS, Size: 37, Number: 1800
> 2013-03-31 15:16:15.022 Type: SSH_FXP_READ, Size: 25, Number: 2053
< 2013-03-31 15:16:52.215 Status code: 1
. 2013-03-31 15:16:52.215 312 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2013-03-31 15:16:52.215 Type: SSH_FXP_CLOSE, Size: 13, Number: 42500
< 2013-03-31 15:16:52.216 Type: SSH_FXP_STATUS, Size: 28, Number: 41733
< 2013-03-31 15:16:52.284 Type: SSH_FXP_STATUS, Size: 28, Number: 41989
< 2013-03-31 15:16:52.348 Type: SSH_FXP_STATUS, Size: 28, Number: 42245
> 2013-03-31 15:16:52.350 Script: exit
. 2013-03-31 15:16:52.350 Script: Exit code: 0
. 2013-03-31 15:16:52.350 Closing connection.
. 2013-03-31 15:16:52.350 Sending special code: 12
. 2013-03-31 15:16:52.350 Sent EOF message

I'm trying to figure out why the *.dump files didn't get synced. Any ideas would be most greatly appreciated!

Thanks!

Reply with quote

Advertisement

Guest

Yes, I do mean the local *.dump files. So the "synchronize remote" switch appears to be what I want.

Is there a way to combine the -delete switch so that the local *.dump files will get copied over to the remote directory, then the local files are deleted?

Reply with quote

Advertisement

You can post new topics in this forum