This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

rsync, ssh and cron


Hi:

I apologize in advance for how long I'm sure this message will turn out to
be.

I am attempting to use rsync to backup some files from my home machine to a
server at night.  This is scheduled using cron, and rsync is using ssh as
its means of connecting to the server.

I have gotten to the point where I can get cron to start up rsync, which
will also then start up an ssh session.  I see my modem lights flash for a
while, and then the ssh process becomes <defunct>, leaving rsync taking up
most of my CPU cycles but obviously making no progress.

I am using RSA authentication with ssh.  After a bit of fooling around, I
figured out that I had CYGWIN32 set in my user environment to "tty binmode"
but not in the system environment.  Even though the cron service is running
as my account, it appears that it doesn't inherit my environment.  This was
causing the read of my identity file to fail.  Ok, sensible enough, I fixed
this by setting CYGWIN32 in the system environment.

Now comes the interesting part.  I decided to test by having cron start up
an xterm, using the command "xterm -display localhost:0".  This had worked
before setting CYGWIN32 in the system environment.  After making the change,
it no longer worked.  So, I took CYGWIN32 back out of the system
environment, and set it in my .bashrc file, which I then sourced in the
script that I am running that invokes rsync.  Now starting an xterm from
cron works again.

So, in that xterm (which should have the same environment as rsync script),
I execute the script.  It works perfectly.

However, it still doesn't work to invoke the script directly from cron.  The
only thing that I can think of that is different is that there is a terminal
associated with the xterm, but there isn't when the script is being run from
cron.  So, from cron, I executed xterm -display localhost:0 -e rsync.script.
This worked just fine.  So perhaps my theory was correct.

So, now that I've got something that works, I should just be happy, right?
But no, I want to know why it works.  Does anyone know what the problem is
here, and if so, how it might work to do this from within cron without
popping up a spurious xterm?

Thanks,
Ryan McFall
mcfallry@cse.msu.edu


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]