Before posting, and to avoid disappointment, please read the following:

  • This forum is not for 2BrightSparks to provide technical support. It's primarily for users to help other users. Do not expect 2BrightSparks to answer any question posted to this forum.
  • If you find a bug in any of our software, please submit a support ticket. It does not matter if you are using our freeware, a beta version or you haven't yet purchased the software. We want to know about any and all bugs so we can fix them as soon as possible. We usually need more information and details from you to reproduce bugs and that is better done via a support ticket and not this forum.

Batch File has worked for 4 years - now doesn't

SyncBackFree is the freeware version of SyncBack. It is *not* an evaluation version of SyncBackPro/SE.
Post Reply
HarryStottle
Newbie
Newbie
Posts: 5
Joined: Tue Jan 29, 2013 7:25 pm

Batch File has worked for 4 years - now doesn't

Post by HarryStottle »

Back in 2013 I had a minor problem recognising the return code from a batch file I used in the "Run Before" section of a profile. Dave Wilkins sorted me out and it has worked like a charm ever since.

For the last two months, however, almost certainly as the result of a Windows Update, it has stopped working. The symptoms are confusing to say the least.

For a start, if I run the profile manually it works as advertised. It is only if running on a schedule that it fails - with the error message that it ran but didn't finish in the expected time (I have tried extending that to 5 minutes but it still fails. It only has one task - to delete an 84 byte text file on the network.)

As it happens, I run another profile before this one, which runs a different batch file AFTER the profile and I was having very similar problems with that one. The trouble seemed to be focussed on some change Windoze has made to the way it recognises networks (other than its own). I'm running these profiles on my workstation but they're backing up data to and from a Novell network. The first profile retrieves the data to my workstation. It then runs my own software to perform a "cleanup and archiving" function. The second profile sends the clean data back to the network.

What I found with the first profile problem was that the software was behaving as though the workstation had gone into sleep mode (it hadn't) and, in the process, "forgotten" its network connections, so the profile was running but the final batch file was failing. One of the actions of the batch file is to copy a "signal" file to a network location. If that file isn't present when the 2nd profile is due to run, the 2nd profile aborts. And the signal file wasn't being copied. I was able to fix that by explicitly deleting the network connection, then re-assigning it in the batch file before it did anything else. That worked.

Then I discovered that the second profile was failing to run because its own batch file (the one Dave helped me sort) was no longer working either.

Initially, I thought it was the same problem, loss of network memory, but the net delete, net use trick didn't work this time. So now I'm in the state where the batch file works on its own. The profile runs perfectly (and instantly) if I run it manually, but if I leave it to the schedule it fails as above.

One final point, thinking it might be something else going into sleep mode, I've even logged in remotely, made sure everything is awake, network drives visible etc, and watched the profile to see if it activates. It does, but then fails as above. If I then immediately run it manually, it works, so it clearly isn't "system state" related.

I am now completely out of ideas!

Suggestions?
HarryStottle
Newbie
Newbie
Posts: 5
Joined: Tue Jan 29, 2013 7:25 pm

Re: Batch File has worked for 4 years - now doesn't

Post by HarryStottle »

OK, resolved. Bit disappointed at the complete absence of response from anyone here but I shall document the fix here, in any case, for the sake of anyone unfortunate enough to follow in my footsteps.

Still no idea why the batch file stopped functioning. The best guess is some change to the way Windows 10 stores it's drive mappings, at least when they're Novell drives. The consequence was that the Syncback profile, which had been working for several years and hadn't been changed, suddenly stopped working about 4 months ago. This particular profile starts by running a batch file before doing anything else and aborts if the batch file failed or returned an exit code of 1. The batch file simply checks for the existence of a file on the network and, if present, deletes it and exits with code 0. That batch file simply stopped functioning whenever run by the scheduled task assigned by Syncback. (But would always work perfectly if I ran it manually)

The fix is to invert the control. I modified the batch file so that, if the file exists, it deletes it and then runs the profile using the syncback command line syntax available. I Then created a standard scheduled task to run the batch file. I then modified the profile to stop running the batch file! (after initially forgetting that step and realising I'd created a potential loop)

Result: Success. The task scheduler runs the batch file and, for some obscure reason, it's now perfectly happy to resume normal service. It detects the file and runs the profile. Job done. (which implies a problem with Syncback's invocation of the windows command processor)

The only complication was that syncback's documentation was less than helpful on the exact syntax and naming required. It implies that something as simple as "syncbackfree.exe" "profile name" will do the job. It doesn't.

a) you need fully qualified pathname to the executable and then pick up the profile name from its definition
b) nor can you use "C:\Program Files (x86)\2BrightSparks\SyncBackFree\SyncBackFree.exe" "Copy Cleaned Files Back to Net" as we might expect. Instead you need to use START /WAIT but
c) there's a glitch in windoze START /WAIT command such that if it encounters inverted commas as above, it treats the first instance as a title instead of a command. The second string gets treated as a command, so, in the above example, START /WAIT would always fail because "Copy Cleaned Files Back to Net" obviously isn't an executable; so you need to place a pointless dummy thus

START /WAIT "DUMMY" "C:\Program Files (x86)\2BrightSparks\SyncBackFree\SyncBackFree.exe" "Copy Cleaned Files Back to Net"

(think I actually picked up that "Dummy" solution somewhere else on this forum but can't retrace my steps now.)

and that, dear readers, works!
Post Reply