Yet another rsync incremental thread

macuserfr macuserfr at free.fr
Mon Jul 28 11:02:21 GMT 2008


Hmmm, I also tried this to use variable from the script calling  
instead of from the script body,  same result (script doesn't  
run : / ) :

freenas:/mnt/data/serveuranm# cat ../timestamp.sh
#!/bin/tcsh
#Turn on debug info
set DEBUG = 0

#Check if we have the good arg number
if( $# < 1 || $# > 1 ) then
	echo "Usage: $0 <name_of_backuped_host>"
	exit
endif

#Name of the backup directory
set BACKUP = backup

#Name of the backup mount (partition)
set MOUNTNAME = data

#Check if the backup directory exists
if( ! ( -e $BACKUP ) ) then
         echo "Directory backup is missing"
	exit
endif

#Set up useful variables
set DATE = `date +"%Y-%m-%d-%H%M%S"`
set AVAIL = `df | grep $MOUNTNAME | awk -F' ' '{print $4}'`
set SIZE = `du -s $BACKUP/ | awk -F' ' '{print $1}'`

if ( $DEBUG ) then
	echo "DATE = $DATE \
AVAIL = $AVAIL \
SIZE = $SIZE"
endif

if( ! ( -e lastest ) ) then
	mv -f $BACKUP lastest
else
         mv -f lastest $1$DATE
         mv -f $BACKUP lastest
endif
while ( $AVAIL < $SIZE )
	rm -Rf `ls -1 | grep $1 | head -n 1`
end
unset *

freenas:/mnt/data/serveuranm# cat /var/etc/rsyncd.conf
syslog facility = local4
list = no
port = 873
pid file = /var/run/rsyncd.pid
uid = rsync

[serveuranm]
comment = Sauvegarde du serveur ANM
path = /mnt/data/serveuranm/
list = true
max connections = 0
read only = false
uid = serveuranm
gid = rsync
post-xfer exec = /mnt/data/timestamp.sh $RSYNC_HOST_NAME

Thanks for any clue of what's wrong.

Best regards,

Vitorio

Le 28 juil. 08 à 09:39, macuserfr a écrit :

> Hi folks, that's me again...
>
> Well, following Matt's suggestion, I'm trying to setup my server to  
> call a post transfer script. Guess what? It's not working and I  
> don't know why. I've looked around other posts in this mail list and  
> googling around. Didn't found what's wrong with my setup. So rsync  
> runs nicely but don't call the post-transfer script. The post  
> transfer script runs fine when I run it manually with root, rsync  
> user or the module defined user (serveuranm). No errors in client  
> side nor in rsyncd log. There is maybe a path/user mistake somewhere.
>
> Client side:
> cwrsync with rsync 3.0.2 and modded cygwin1.dll in order to have  
> long name support.
>
> cwrsync.cmd batch rsync file content:
>
> @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=%PROGRAMFILES%\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 nodosfilewarning codepage:utf8
>
> SET LC_CTYPE="C-UTF-8"
>
> 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/work/*
> REM
> REM Example 1 - rsync recursively to a unix server with an openssh  
> server :
> REM
> REM       rsync -r /cygdrive/c/work/ remotehost:/home/user/work/
> 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
> rsync -ab --link-dest="/lastest" --size-only --chmod=ugo=rwX / 
> cygdrive/c/DossiersPartages 172.20.30.194::serveuranm/backup
>
> Server side:
>
> freenas:~# cat /var/etc/rsyncd.conf
> syslog facility = local4
> list = no
> port = 873
> pid file = /var/run/rsyncd.pid
> uid = rsync
>
> [serveuranm]
> comment = Sauvegarde du serveur ANM
> path = /mnt/data/serveuranm/
> list = true
> max connections = 0
> read only = false
> uid = serveuranm
> gid = rsync
> post-xfer exec = /mnt/data/timestamp.sh
>
> freenas:~# cat /var/log/rsyncd.log
> Jul 24 09:46:13 freenas rsyncd[18257]: connect from  
> serveuranm.domaineanm.fr (172.20.30.197)
> Jul 24 09:46:13 freenas rsyncd[18258]: rsync to serveuranm/backup  
> from serveuranm.domaineanm.fr (172.20.30.197)
> Jul 24 09:46:13 freenas rsyncd[18258]: receiving file list
> Jul 24 10:57:40 freenas rsyncd[18258]: sent 18697 bytes  received  
> 1935199 bytes  total size 22859727296
> Jul 24 13:07:37 freenas rsyncd[23442]: connect from  
> serveuranm.domaineanm.fr (172.20.30.197)
> Jul 24 13:07:37 freenas rsyncd[23443]: rsync to serveuranm/backup  
> from serveuranm.domaineanm.fr (172.20.30.197)
> Jul 24 13:07:37 freenas rsyncd[23443]: receiving file list
> Jul 24 14:12:42 freenas rsyncd[23443]: sent 42471 bytes  received  
> 2353855 bytes  total size 22859731464
>
> freenas:~# ls -l /mnt/data/
> total 24
> drwxrwxrwx  2 root        wheel      512 Jul  2 17:36 .AppleDB
> drwxrwxrwx  2 ftp         wheel      512 Jul  2 17:36 .AppleDesktop
> drwxrwxrwx  2 ftp         wheel      512 Jul  2 17:36 .AppleDouble
> -rw-rw-rw-  1 ftp         wheel     6148 Jul  2 17:36 .DS_Store
> drwxrwxr-x  2 root        operator   512 Jan  8  2001 .snap
> drwxrwxrwx  3 ftp         wheel      512 Jul  2 17:36 Network Trash  
> Folder
> drwxrwxrwx  3 ftp         wheel      512 Jul  2 17:36 Temporary Items
> drwxrwxrwx  6 serveuranm  rsync      512 Jul 24 13:07 serveuranm
> -rwxr-xr-x  1 root        wheel      734 Jul 22 18:02 timestamp.sh
>
> freenas:~# cat /mnt/data/timestamp.sh
> #!/bin/tcsh
> #Turn on debug info
> set DEBUG = 0
>
> #Name of the backup directory
> set BACKUP = backup
>
> #Name of the backup mount (partition)
> set MOUNTNAME = data
>
> #Check if the backup directory exists
> if( ! ( -e $BACKUP ) ) then
>        echo "Directory backup is missing"
> 	exit
> endif
>
> #Set up useful variables
> set DATE = `date +"%Y-%m-%d-%H%M%S"`
> set AVAIL = `df | grep $MOUNTNAME | awk -F' ' '{print $4}'`
> set SIZE = `du -s $BACKUP/ | awk -F' ' '{print $1}'`
>
> if ( $DEBUG ) then
> 	echo "DATE = $DATE \
> AVAIL = $AVAIL \
> SIZE = $SIZE"
> endif
>
> if( ! ( -e lastest ) ) then
> 	mv -f $BACKUP lastest
> else
>        mv -f lastest $1$DATE
>        mv -f $BACKUP lastest
> endif
> while ( $AVAIL < $SIZE )
> 	rm -Rf `ls -1 | grep $1 | head -n 1`
> end
> unset *
>
> freenas:/mnt/data/serveuranm# cat /etc/passwd
> root:*:0:0:Charlie &:/root:/bin/tcsh
> toor:*:0:0:Bourne-again Superuser:/root:
> daemon:*:1:1:Owner of many system processes:/root:/usr/sbin/nologin
> operator:*:2:5:System &:/:/usr/sbin/nologin
> bin:*:3:7:Binaries Commands and Source:/:/usr/sbin/nologin
> tty:*:4:65533:Tty Sandbox:/:/usr/sbin/nologin
> kmem:*:5:65533:KMem Sandbox:/:/usr/sbin/nologin
> www:*:80:80:World Wide Web Owner:/nonexistent:/usr/sbin/nologin
> nobody:*:65534:65534:Unprivileged user:/nonexistent:/usr/sbin/nologin
> ftp:*:21:50:FTP user:/mnt:/sbin/nologin
> man:*:9:9:Mister Man Pages:/usr/share/man:/usr/sbin/nologin
> sshd:*:22:22:Secure Shell Daemon:/var/empty:/usr/sbin/nologin
> _dhcp:*:65:65:dhcp programs:/var/empty:/usr/sbin/nologin
> serveuranm:*:11212:1001:Sauvegarde du serveur ANM:/mnt/data/ 
> serveuranm/:/bin/tcsh
> rsync:*:11211:1001:Sauvegarde via rsync:/mnt/data/:/bin/tcsh
>
> Maybe there is a problem because the script is not on the path of  
> the module, but I read that the post-xfer exec is not chrooted so I  
> could find any path of the system. The script is readable and  
> executable by all users.
>
> PS: I don't have strace installed on this server.
>
> Thanks for any help on this. I'm sure it's a dumb mistake but I'm  
> too close to see it. I've rechecked setup many times without seeing  
> anything wrong.
>
> Best regards,
>
> Vitorio



More information about the rsync mailing list