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

2020-04-02 Thread raf via rsync
Hi Leon,

No worries. I'm glad you managed to get something working.

cheers,
raf

Leon Vanderploeg wrote:

>   Hi raf,
> 
> I was not aware the network maps were "user experience".  Thanks for
> your tips.  I have tried everything I can come up with, but cannot get it
> to work.  I figured out another solution, but thank you very much for your
> help.
> 
> Best,
> Leon
> 
> On Sun, Mar 29, 2020 at 9:23 PM raf via rsync  wrote:
> 
> > Leon Vanderploeg via rsync wrote:
> >
> > > Greetings,
> > >
> > > 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
> > > (2)
> > > 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
> > > fails.
> > > 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=/ @remote:/  /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,
> > > Leon
> >
> > Hi,
> >
> > I think the most likely reason is that when you execute
> > the command interactively, you are logged into Windows
> > locally and your cached credentials are used to connect
> > to the mapped drive. But that's not the case when the
> > task is scheduled, and so the mapped drive isn't mapped
> > when the scheduled task is attempted.
> >
> > Similarly, with Cygwin, you can only see
> > /cygdrive/q/... while you are accessing it locally. If
> > you ssh to a Windows host with Cygwin and sshd running,
> > you can't see any mapped drives that are accessible to
> > the local user, even if you ssh in as the same user.
> >
> > You will have to map the drive in the scheduled task
> > before invoking rsync, and then unmap the drive
> > afterwards. I don't know how to do that or handle the
> > credentials that would be needed, but I think that's
> > where to look.
> >
> > cheers,
> > raf
> >
> >
> > --
> > Please use reply-all for most replies to avoid omitting the mailing list.
> > To unsubscribe or change options:
> > https://lists.samba.org/mailman/listinfo/rsync
> > Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
> >

-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


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

2020-04-02 Thread Leon Vanderploeg via rsync
  Hi raf,

I was not aware the network maps were "user experience".  Thanks for
your tips.  I have tried everything I can come up with, but cannot get it
to work.  I figured out another solution, but thank you very much for your
help.

Best,
Leon

On Sun, Mar 29, 2020 at 9:23 PM raf via rsync  wrote:

> Leon Vanderploeg via rsync wrote:
>
> > Greetings,
> >
> > 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
> > (2)
> > 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
> > fails.
> > 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=/ @remote:/  /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,
> > Leon
>
> Hi,
>
> I think the most likely reason is that when you execute
> the command interactively, you are logged into Windows
> locally and your cached credentials are used to connect
> to the mapped drive. But that's not the case when the
> task is scheduled, and so the mapped drive isn't mapped
> when the scheduled task is attempted.
>
> Similarly, with Cygwin, you can only see
> /cygdrive/q/... while you are accessing it locally. If
> you ssh to a Windows host with Cygwin and sshd running,
> you can't see any mapped drives that are accessible to
> the local user, even if you ssh in as the same user.
>
> You will have to map the drive in the scheduled task
> before invoking rsync, and then unmap the drive
> afterwards. I don't know how to do that or handle the
> credentials that would be needed, but I think that's
> where to look.
>
> cheers,
> raf
>
>
> --
> Please use reply-all for most replies to avoid omitting the mailing list.
> To unsubscribe or change options:
> https://lists.samba.org/mailman/listinfo/rsync
> Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
>
-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


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

2020-03-29 Thread raf via rsync
Leon Vanderploeg via rsync wrote:

> Greetings,
> 
> 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
> (2)
> 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
> fails.
> 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=/ @remote:/  /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,
> Leon

Hi,

I think the most likely reason is that when you execute
the command interactively, you are logged into Windows
locally and your cached credentials are used to connect
to the mapped drive. But that's not the case when the
task is scheduled, and so the mapped drive isn't mapped
when the scheduled task is attempted.

Similarly, with Cygwin, you can only see
/cygdrive/q/... while you are accessing it locally. If
you ssh to a Windows host with Cygwin and sshd running,
you can't see any mapped drives that are accessible to
the local user, even if you ssh in as the same user.

You will have to map the drive in the scheduled task
before invoking rsync, and then unmap the drive
afterwards. I don't know how to do that or handle the
credentials that would be needed, but I think that's
where to look.

cheers,
raf


-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


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

2020-03-28 Thread Leon Vanderploeg via rsync
Greetings,

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
(2)
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
fails.
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=/ @remote:/  /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,
Leon
-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html