<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2018-01-13 16:11 GMT+01:00 Richard Kettlewell <span dir="ltr"><<a href="mailto:rjk@terraraq.org.uk" target="_blank">rjk@terraraq.org.uk</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">On 2018-01-05 17:24, Samuel Wolf wrote:<br>
>     > My pre-script:<br>
>     > #/bin/bash<br>
>     > DESTHOST=windowsclient<br>
>     > mount -t cifs //${DESTHOST}/DATA$ /mnt/${DESTHOST} -o<br>
>     > username=rsbackup,password=<wbr>xxx,domain=${DESTHOST}<br>
>     > IS_MOUNTED=`mount | grep ${DESTHOST}`<br>
>     > if [ "x$IS_MOUNTED" = x ] ; then<br>
>     >                 echo "${DESTHOST} not mounted."<br>
>     >                 exit 1<br>
>     > fi<br>
>     > exit 0<br>
>     ><br>
>     > Now I add a host in rsbackup:<br>
>     ><br>
>     > host windowsclient<br>
>     >   hostname localhost<br>
>     >   volume data /mnt/windowsclient<br>
>     >     pre-backup-hook /etc/rsbackup/scripts/pre-<wbr>backup-windowsclient.sh<br>
>     ><br>
>     > Issue now, rsbackup thinks with "localhost" the client is every time<br>
>     > online, but this is not the case.<br>
>     > In the worst case rsbackup copy an empty folder from /mnt/windowsclient.<br>
><br>
>     What is supposed to happen is that when the pre-backup-hook fails,<br>
>     rsbackup does not backup that volume. See the check on rc in<br>
</span>>     <a href="https://github.com/ewxrjk/rsbackup/blob/master/src/MakeBackup.cc#L301" rel="noreferrer" target="_blank">https://github.com/ewxrjk/<wbr>rsbackup/blob/master/src/<wbr>MakeBackup.cc#L301</a> <<a href="https://github.com/ewxrjk/rsbackup/blob/master/src/MakeBackup.cc#L301" rel="noreferrer" target="_blank">https://github.com/ewxrjk/<wbr>rsbackup/blob/master/src/<wbr>MakeBackup.cc#L301</a>><br>
<span class="gmail-">>     for instance. So if the issue persists with the current version, check<br>
>     what exit status your script produces when the mount operation fails.<br>
><br>
><br>
> This work as expected, unfortunately my cron job send me now hourly a mail:<br>
> /etc/cron.hourly/rsbackup:<br>
> WARNING: backup of tester:daten to hddbackupserver: preBackup: exited<br>
> with status 1<br>
> ping: tester: Name or service not known<br>
> umount: /mnt/tester: not mounted<br>
<br>
</span>'tester' doesn't appear in the quoted configuration, so I think this<br>
must be from other host.<br></blockquote><div><br></div><div>Sorry, i rename it during testing some setups.<br>First idea was to mount (pre-backup-hook) the share before the volume and check *inside* the volume it is mounted.<br><br>host tester<br>  hostname localhost<br>  pre-backup-hook /etc/rsbackup/scripts/pre-tester.sh<br>  post-backup-hook /etc/rsbackup/scripts/post-tester.sh<br>  volume data /mnt/tester<br>    check-mounted true<br><br>But "check-mounted true" inside the volume is also executing after the pre-backup-hook inside the host,<br>so rsbackup can never backup this host.<br><br>Second idea is pre-backup-hook return value !=0 which result in a error message every cron run if the host is offline.<br><br>If "check-mounted true" inside the volume will executing after the pre-backup-hook inside the host everythink would be fine without<br>error message from the cron.<br>Hostname "localhost" with a ping check before backup will solve this problem as well.<br><br>Is there any other idea to solve this issue?</div><div><br></div><div>###########</div><div><br></div><div>pre-script:<br>#/bin/bash<br>DESTHOST=tester<br>if ping -c 1 -w 1 ${DESTHOST} >/dev/null ; then<br>        mount -t cifs //${DESTHOST}/DATA /mnt/tester -o username=backupuser,password=123456789,domain=${DESTHOST}<br>        IS_MOUNTED=`mount | grep ${DESTHOST}`<br>        if [ "x$IS_MOUNTED" = x ] ; then<br>                echo "${DESTHOST} not mounted. exit."<br>                exit 1<br>        fi<br>   else<br>        echo "offline"<br>        exit 1<br>fi<br>exit 0<br><br><br>post-script:<br>#/bin/bash<br>umount /mnt/tester<br>exit 0<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
ttfn/rjk<br>
<br>
</blockquote></div><br></div></div>