Newbie questions

10 posts / 0 new
Last post
Anonymous
Newbie questions

Sorry if a lot of this sounds pretty lame. I really don't have much of a technical background and I just stumbled on this board. I was also unsure how to search to see if my questions had been answered previously. Any help (responses, links, etc.) would be greatly appreciated.

I have cwRsync installed and was hoping to modify the batch file to handle a few things.

 1. I'm interested in syncing data that is local with a network drive that uses a different username and password. The username is "Mike" and the IP is 192.168.1.100. The drive name is mounted as "linux" (i can browse to http://192.168.1.100 or http://linux and get similar results).

If I'm interested in copying everything from:

/cygdrive/c/temp/

to:

/var/www/temp/

on the linux server, i assume i need to set an ssh-user (as i'd seen in previous examples). The following doesn't seem to work for me:

rsync -avz -e "ssh -l Mike" /cygdrive/c/Temp/ linux:/var/www/synctest/

I receive the following error:

sh: line 1: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far)
rsync error: error in rsync protocol data stream (code 12) at io.c(453)

2. Ultimately, what I'd like to accomplish is to upload files from this linux server to a remote server for back-up purposes. For example, I'd like to copy files from here:

linux:/var/www/project/

to here:

www.mysite.com/project/client01/

and here:

www.mysite.com/project/client02/

Where, 99% of the files are the same, and 1% need to have client-specific changes to the files.

I'd love to do this from my windows machine, connect to the linux computer using the "Mike" username and password, and sync to the remote server using a different username and password. I don't know anything about creating modules, so if that's preferred for this...please help point me to a good lay-person description of how to go about this.

Any and all help you provide is graciously appreciated. Please let me know if you need further information. The below is my modified batch file, for your convenience in troubleshooting:

 @ECHO OFF
REM *****************************************************************
REM
REM CWRSYNC.CMD - Batch file template to start your rsync command (s).
REM
REM By Tevfik K. (http://itefix.no)
REM *****************************************************************

REM Make environment variable changes local to this batch file
SETLOCAL

REM ** CUSTOMIZE ** Specify where to find rsync and related files (C:\CWRSYNC)
SET CWRSYNCHOME=C:\PROGRAM FILES\cwRsync

REM Set CYGWIN variable to 'nontsec'. That makes sure that permissions
REM on your windows machine are not updated as a side effect of cygwin
REM operations.
SET CYGWIN=nontsec

REM Set HOME variable to your windows home directory. That makes sure
REM that ssh command creates known_hosts in a directory you have access.
SET HOME=%HOMEDRIVE%%HOMEPATH%

REM Make cwRsync home as a part of system PATH to find required DLLs
SET CWOLDPATH=%PATH%
SET PATH=%CWRSYNCHOME%\BIN;%PATH%

REM Windows paths may contain a colon (:) as a part of drive designation and
REM backslashes (example c:\, g:\). However, in rsync syntax, a colon in a
REM path means searching for a remote host. Solution: use absolute path 'a la unix',
REM replace backslashes (\) with slashes (/) and put -/cygdrive/- in front of the
REM drive letter:
REM
REM Example : C:\WORK\* --> /cygdrive/c/@temp/*
REM
REM Example 1 - rsync recursively to a unix server with an openssh server :
REM
       rsync -avz -e "ssh -l mike"  /cygdrive/c/Temp/ linux:/var/www/synctest/
REM
REM Example 2 - Local rsync recursively
REM
REM       rsync -r /cygdrive/c/work/ /cygdrive/d/work/doc/
REM
REM Example 3 - rsync to an rsync server recursively :
REM    (Double colons?? YES!!)
REM
REM       rsync -r /cygdrive/c/doc/ remotehost::module/doc
REM
REM Rsync is a very powerful tool. Please look at documentation for other options.
REM

REM ** CUSTOMIZE ** Enter your rsync command(s) here

itefix
Offline
Last seen: 1 week 5 hours ago
Joined: 01.05.2008 - 21:33
Re: Newbie questions

rsync -avz -e "ssh -l Mike" /cygdrive/c/Temp/ linux:/var/www/synctest/

I receive the following error:

sh: line 1: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far)
rsync error: error in rsync protocol data stream (code 12) at io.c(453)

This tells me that rsync is not available via at the server side (machine linux) when logged as the user Mike.

cwrsync_noob
Re: Newbie questions

You were absolutely correct. And your recommendation got me so far. I have a couple more small questions. I'm having problems retaining permissions and ownership when I sync between the locally-mapped linux server (/cygdrive/w/mysource/) and the remote linux server (home/mydest/www/).

 My rsync script looks like this:

rsync -avz --timeout=300 --exclude "templates_c/*" -e ssh /cygdrive/w/mysource/ root@123.123.123.123:/home/mydest/www/

before the sync, everything has the correct permissions and ownership, which should be:
myuser:nobody

after the sync, everything is changed to:
400:401

Also, I want to retain the ownership privileges of all files on the server where most of them are set to 0755, but a few are 0777 (required for templating system). How can i have it stop overwriting the privileges on the server. It currently sets everything to 0755, even though the local (mysource) folders may have 0777 specified.

Bonus question: After I learn how to retain privileges and ownerships, i'm interested in also learning how to specify folder-specific privileges and ownership with rsync...however, that's secondary to ensuring the folders retain the existing privileges.

Any and all assistance is greatly appreciated.

cwrsync_noob
Re: Newbie questions

does any cwrsync or rsync guru have time or interest in helping me troubleshoot this? i feel the forums postings is tough for me to explain my questions and was hoping someone would be interested in skype/MSN/ICQ/Y!/AIM/emailing. it'd probably resolve my questions so much faster. i realize this may be asking a lot, but I really don't know what I'm doing here.

cwrsync_noob
Re: Newbie questions

Anyone? Please?

itefix
Offline
Last seen: 1 week 5 hours ago
Joined: 01.05.2008 - 21:33
Re: Newbie questions

cwRsync is not capable of processing permissions/ownership from linux to windows or vice versa.

cwrsync_noob
Re: Newbie questions

Can I just use Rsync for this then?

itefix
Offline
Last seen: 1 week 5 hours ago
Joined: 01.05.2008 - 21:33
Re: Newbie questions

cwRsync is simply rsync on cygwin. It is rsync !!

cwrsync_noob
Re: Newbie questions

is Rsync capable of managing/processing ownership/permissions from linux to linux?

itefix
Offline
Last seen: 1 week 5 hours ago
Joined: 01.05.2008 - 21:33
Re: Newbie questions

is Rsync capable of managing/processing ownership/permissions from linux to linux?

Yes. See rsync documentation for more details.

Topic locked

Release announcements