Problem
I want to run SyncBackSE (version 4.5.15.0) on my Windows 7 system and have it backup via FTP over a tincVPN connection to another system (In this case Ubuntu 10.10 Linux, but that doesn’t matter). I want it to run every time I log on / turn on the Windows 7 system. I have Windows 7 configured to automatically log on my user. SyncBackSE has the ability to initiate a backup upon logon. It attempts 5 times to make the FTP connection to the backup host waiting a small number of seconds (25?) between each attempt. tincVPN takes a variable amount of time to establish a connection with the other tincVPN system, sometimes up to 10 minutes. If that connection time takes more than a minute and a half, SyncBackSE gives up and reports a “Scan Failure”.
I attempted to modify the SyncBackSE profile using the “Programs - Before” section to run a check before the profile to force SyncBackSE to wait for the VPN connection to be established. I wasn’t able to get this to work.
Though SyncBackSE has that ability to tweak timeout limits and reconnection attempts for FTP, these don’t apply with the initial connection, only reconnecting.
Solution
I solved this in the following way :
- Deleted all logon based or time based scheduled runs of SyncBackSE from within SyncBackSE.
- Created a batch file which loops and tests the connection, only launching SyncBackSE after it confirms the connection is established. Here is example code of my batch file, launch-syncbackse.bat :
@echo off set TARGET=10.0.0.100 echo "Waiting for %TARGET% to become reachable before starting backup." :start REM Sleep 5 choice /T 5 /D y >nul ping -n 1 %TARGET% | find "bytes=32" if NOT "%ERRORLEVEL%"=="0" goto :start start "SyncbackSE" "C:\Program Files (x86)\2BrightSparks\SyncBackSE\SyncBackSE.exe" -m "MyProfileName" exit
- Downloaded the tool, Hidden Start. We’ll use this to hide the batch file window while it waits for the VPN to connect
- Unzipped/installed hstart to some location
- Created a Folder within the Windows 7 Task Scheduler under “Task Scheduler Library” for my custom tasks (to make them easier to find)
- Created a new task in this Task Scheduler folder to run this batch file
- General : Checked “Run with highest privelages {note}This is absolutely vital. Because of the fact that SyncBackSE is a backup application and needs to be able to backup system files and other sensitive data, it must have administrative rights to run.{note}
- Triggers : “At log on”
- Actions :
- Created a new action of “Start a Program”
- Program/script : “C:\path\to\hstart.exe”
- Add arguments (optional) : “/NOCONSOLE C:\path\to\launch-syncbackse.bat”
In my solution I assume the following :
- The system on the other end of the VPN, the FTP server, is 10.0.0.100
- The path to hstart is C:\path\to\hstart.exe
- The path to the batch file is C:\path\to\launch-syncbackse.bat
Result
After setting this up, here’s what happens.
- I boot into Windows 7 (in my case it auto logs me in)
- Upon login hstart.exe launches the batchfile in the background. There is no command window shown. You can see the batch file looping by viewing the process with a tool like Process Explorer
- Once the tincVPN establishes a connection and the target FTP server is pingable, the batch file launches SyncBackSE telling it to start the profile
- SyncBackSE runs the profile and does the backup