question abount pre-xfer exec

Kevin Korb kmk at sanitarium.net
Sat Sep 24 13:27:59 UTC 2022


You aren't logging any stderr.  That is where any error messages would 
go.  Add some 2>&1.
Also, mount has a -v

On 9/24/22 09:15, dotdeb--- via rsync wrote:
> 
> I've been using rsync for years to backup my machines both at work and 
> at home.
> These days I faced a new "challenge": at work I connect my laptop to a 
> docking station with an external usb disk. I'd like to use this disk as 
> a backup volume.
> 
> I put my disk in /etc/fstab to be mounted at boot (with 'nofail' option 
> to avoid errors when I'm at home). I have no problems if the laptop is 
> booted after the connection to the docking station but, if I work at 
> home, suspend the laptop and then go to work and connect it to the 
> docking station and resume it, the /backup volume will not be mounted 
> automatically.
> 
> I found that rsyncd.conf can execute scripts before and I tried to 
> create a script to be executed (as early stage or pre transfer? a bit 
> confuser about it) to check if /backup is mounted and mount it if not.
> 
> I verified that the script is executed (I put there some debugging 
> "echo" sent to the log file) but the mount command within it does not 
> mount anything.
> 
> Here it is the rsyncd.conf
> 
> ##################################
> read only = false
> write only = false
> usechroot = true
> uid = 0
> gid = 0
> 
> early exec = /tmp/test-pre-exec
> 
> [rsync-backup-xxx]
>          comment Local rsync-backup of xxx
>          path = /backup/xxx
>          log file = /var/log/rsyncd.log
> ##################################
> 
> and the script /tmp/test-pre-exec
> 
> ##################################
> #!/bin/sh
> 
> echo -n "executing pre-xfer script ..." >> /var/log/rsyncd.log
> 
> if ! grep -qs '/backup ' /proc/mounts
> then
>      echo -n "mounting /backup ..." >> /var/log/rsyncd.log
>      /usr/bin/mount >> /var/log/rsyncd.log
> fi
> 
> echo " done" >> /var/log/rsyncd.log
> 
> exit 0
> ##################################
> 
> 

-- 
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,
	Kevin Korb			Phone:    (407) 252-6853
	Systems Administrator		Internet:
	FutureQuest, Inc.		Kevin at FutureQuest.net  (work)
	Orlando, Florida		kmk at sanitarium.net (personal)
	Web page:			https://sanitarium.net/
	PGP public key available on web site.
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,



More information about the rsync mailing list