Rsync to Network Share works from cmd but fails from Scheduled Task

Leon Vanderploeg leonv at
Sat Mar 28 21:29:40 UTC 2020


I have written a C program that runs on Windows servers and does overhead
and reporting for backup administration.  The program calls rsync for the
actual data copy function.  It copies data from a remote system to a local
drive and that works fine.  However, I have recently made changes to copy
the data to a mapped drive on a NAS device instead of the local drive.

The changes work fine when run from a command line, but fail when run from
a scheduled task or cron job:
    rsync: mkdir "/cygdrive/q/restores" failed: No such file or directory
    rsync error: error in file IO (code 11) at main.c(675) [Receiver=3.1.2]
Note:  The folder already exists and permissions are open for Administrator.

Command line that works is bash command to call the C program under
Administrator login.
Scheduled task built as Administrator with or without highest privileges
Tried Cron entry built under Administrator and it fails.

Here is the Rsync command (abbreviated) called by the C program:
rsync  -rltgoD --chmod=Du+w,u+r,u+x -e "ssh -p 33222 -i
\"/cygdrive/c/Users/administrator/.ssh/id_rsa\"" --stats --files-from=/...
-vv --exclude-from=/.... <usr>@remote:/<remote_loc>  /cygdrive/q/restores

Note: q is the mapped drive to the NAS share.

So, what can be done to track this down?  Why would running as a scheduled
task or cron job fail when command line works?  I am willing to do any kind
of tracing if someone can provide directions on how to do that.

Thanks in advance,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the rsync mailing list