My time
 
My weather
Lugano

Partly cloudy
Temp.: 25°C
Humid.: 30%
 
About this blog
 
Blogroll
 
My Company
 

Run DeltaCopy over ssl, via Task Scheduler even if no user is logged on

Published on Friday, March 23rd, 2012 by Maurizio Mutti

The problem

If you want to use DeltaCopy over SSL and run it as a scheduled task, it will work perfectly when a user is logged into windows.
So if you try to run the scheduled task from the scheduled task manager, it will work!But when it will run as scheduled and no user is logged in, the DeltaCopy executable will run but nothing will be copied.
The following precess will be visible in the task manager: DeltaC.exe, ssh.exe, and rsync.exe.
To add you server to the known host list, simply test manually the connection:
ssh ServerIP -l Username -i SSHKEYS -p 22

The solution

When the task  is started from the scheduled task manager the user home directory is set to the root of the windows driver (usually C:).
But when the user is logged on, the user home directory point to “C:\Documents and Settings\UserName\” at least in windows 7.
The problem is that Ssh.exe create a .ssh directoty as a subfolder on the user home directory, there it saves the know_hosts file which contains the host’s list of known ssl servers.When ssh.exe does not find the server on the list, it will ask for a user to confirm the host, this causes a dead lock on the programs.

The quick and dirty way

Copy the know_hosts file where ssh.exe expect to find it, in a subfolder of the windows drive root called .ssh .

The elegant way

Instead of executing directly the DeltaCopy profile from the scheduled task, run batch file.
It will set the needed environnement variables and then run the DeltaCopy profile.
As in the following code sample:
SET HOME=%USERPROFILE%
"C:\Program Files\DeltaCopy\{YourProfile}.dcp"

Bibliography

Some interesting guides about the topic:

Share

One Response to “Run DeltaCopy over ssl, via Task Scheduler even if no user is logged on”

  1. MarcosBL says:

    Saved the day with this after a couple hours of frustration !

    TYVM ! 😀

Leave a Reply