Real-time sync of large files.

Welcome to BestSync Support Forum!
If you have any questions, comments, concerns, suggestion, please summit here, we'll try to reply you in short time.
Thank you!
RiseFly
Site Admin
Posts: 1077
Joined: Tue Nov 03, 2009 2:51 pm

Re: Real-time sync of large files.

Post by RiseFly »

Re i) If you use the command line with /nosvc option, even a task in the normal project file will run once, but please do not run the real-time task, it will never end.

Re ii) If you start the task by command line, and the task is already running, the task will be started twice. It will find the changed files and sync them. If the two same tasks run simultaneously, one file may be copied twice, or fail with access denied error.

If the task is not set as a real-time sync task, BestSyncSvc.exe will end after the task finishs. You can us the following script to detect whether BestSyncSvc.exe is running, if it is running, just wait for it ends.
------------------------------------------------------------------------------
set svc=getobject("winmgmts:root\cimv2")
sQuery="select * from win32_process where name='BestSyncSvc.exe'"
set cproc=svc.execquery(sQuery)
iniproc=cproc.count 'it can be more than 1
Do While iniproc = 1
wscript.sleep 2000
set svc=getobject("winmgmts:root\cimv2")
sQuery="select * from win32_process where name='BestSyncSvc.exe'"
set cproc=svc.execquery(sQuery)
iniproc=cproc.count
Loop
------------------------------------------------------------------------------
gdu90
Posts: 15
Joined: Wed May 18, 2011 9:27 am

Re: Real-time sync of large files.

Post by gdu90 »

re. (i), this is working as you describe with "/NoSvc". The new service runs the specified task and then ends. Thanks.

However,

re. (ii) if there is already an instance of the service running, the script does not end. In taskmgr.exe you can see the new instance start, sync, and end (as per (i) above) but the old instance is still running so the query still returns a "hit" and the script keeps looping. It is afterwards possible to stop this old instance by command line with "/Stop" but you cannot script this to happen AFTER the new instance runs because the script will never get that far; it must be stopped BEFORE the new instance is launched. And it is necessary to wait after issuing this "/Stop" before launching the new instance, so that the correct instance is stopped.

So, my questions to script this -
(a) what is the behaviour of BestSyncSvc.exe when a stop is issued in the middle of a sync, does it stop immediately or does it complete the sync and then stop ?
(b) Is there any way to detect in a script whether a sync is actually in progress ?
(c) If there are TWO instances already running (eg. by two user logons), will one "/Stop" stop them both, or do you need to issue one "/Stop" per instance/user ?
Post Reply