Backup windows share with rsbackup?
Samuel Wolf
samuelwolf85 at googlemail.com
Wed Jan 17 15:14:24 GMT 2018
2018-01-13 16:11 GMT+01:00 Richard Kettlewell <rjk at terraraq.org.uk>:
> On 2018-01-05 17:24, Samuel Wolf wrote:
> > > My pre-script:
> > > #/bin/bash
> > > DESTHOST=windowsclient
> > > mount -t cifs //${DESTHOST}/DATA$ /mnt/${DESTHOST} -o
> > > username=rsbackup,password=xxx,domain=${DESTHOST}
> > > IS_MOUNTED=`mount | grep ${DESTHOST}`
> > > if [ "x$IS_MOUNTED" = x ] ; then
> > > echo "${DESTHOST} not mounted."
> > > exit 1
> > > fi
> > > exit 0
> > >
> > > Now I add a host in rsbackup:
> > >
> > > host windowsclient
> > > hostname localhost
> > > volume data /mnt/windowsclient
> > > pre-backup-hook /etc/rsbackup/scripts/pre-
> backup-windowsclient.sh
> > >
> > > Issue now, rsbackup thinks with "localhost" the client is every
> time
> > > online, but this is not the case.
> > > In the worst case rsbackup copy an empty folder from
> /mnt/windowsclient.
> >
> > What is supposed to happen is that when the pre-backup-hook fails,
> > rsbackup does not backup that volume. See the check on rc in
> > https://github.com/ewxrjk/rsbackup/blob/master/src/
> MakeBackup.cc#L301 <https://github.com/ewxrjk/rsbackup/blob/master/src/
> MakeBackup.cc#L301>
> > for instance. So if the issue persists with the current version,
> check
> > what exit status your script produces when the mount operation fails.
> >
> >
> > This work as expected, unfortunately my cron job send me now hourly a
> mail:
> > /etc/cron.hourly/rsbackup:
> > WARNING: backup of tester:daten to hddbackupserver: preBackup: exited
> > with status 1
> > ping: tester: Name or service not known
> > umount: /mnt/tester: not mounted
>
> 'tester' doesn't appear in the quoted configuration, so I think this
> must be from other host.
>
Sorry, i rename it during testing some setups.
First idea was to mount (pre-backup-hook) the share before the volume and
check *inside* the volume it is mounted.
host tester
hostname localhost
pre-backup-hook /etc/rsbackup/scripts/pre-tester.sh
post-backup-hook /etc/rsbackup/scripts/post-tester.sh
volume data /mnt/tester
check-mounted true
But "check-mounted true" inside the volume is also executing after the
pre-backup-hook inside the host,
so rsbackup can never backup this host.
Second idea is pre-backup-hook return value !=0 which result in a error
message every cron run if the host is offline.
If "check-mounted true" inside the volume will executing after the
pre-backup-hook inside the host everythink would be fine without
error message from the cron.
Hostname "localhost" with a ping check before backup will solve this
problem as well.
Is there any other idea to solve this issue?
###########
pre-script:
#/bin/bash
DESTHOST=tester
if ping -c 1 -w 1 ${DESTHOST} >/dev/null ; then
mount -t cifs //${DESTHOST}/DATA /mnt/tester -o
username=backupuser,password=123456789,domain=${DESTHOST}
IS_MOUNTED=`mount | grep ${DESTHOST}`
if [ "x$IS_MOUNTED" = x ] ; then
echo "${DESTHOST} not mounted. exit."
exit 1
fi
else
echo "offline"
exit 1
fi
exit 0
post-script:
#/bin/bash
umount /mnt/tester
exit 0
>
> ttfn/rjk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.chiark.greenend.org.uk/pipermail/sgo-software-discuss/attachments/20180117/115bc931/attachment.html>
More information about the sgo-software-discuss
mailing list