This is the old XigmaNAS forum in read only mode,
it will taken offline by the end of march 2021!



I like to aks Users and Admins to rewrite/take over important post from here into the new fresh main forum!
Its not possible for us to export from here and import it to the main forum!

rsync and cron #2

Synchronize files & directories to/from XigmaNAS with minimal data transfer.
Forum rules
Set-Up GuideFAQsForum Rules
Post Reply
ijeffsc
Starter
Starter
Posts: 23
Joined: 05 Dec 2015 13:11
Location: NY, ON, Krabi Thailand
Status: Offline

rsync and cron #2

Post by ijeffsc »

cron and rsync #2

<editorial>
OK on to rsync configuration
</editorial>

Synopsis: so is this issue a bug? Are there two bugs?

So I do have rsync working using my own script and the cron setup though it is problematic to configure using the GUI per my pervious topic/thread. The GUI rsync configuration is delicious looking and nearly works as below for my application.

I’ve run rsync in a manner similar to this for many years (nay decades):

Code: Select all

rsync -some_options somedirectory/or/other some host:/pathto/other/files
By default this seems to invoke ssh and if I set up the certificates correctly all works fine. Indeed this works on nas4free across operating systems fairly well at the command line. I’ve never really seen the need for the rsyncd as a result and not sure why anyone would bother but would be happy to learn as YMMV. It seems that recently the ability to run without the rsync daemon in client mode has been added to the GUI (since 2013?).

I’m running NAS4Free 10.2.0.2 (2118).

The GUI seems to make a few sensible modifications. It creates this file:

Code: Select all

[ijeff@nas4free /var/run]$ ls -l /var/run/rsync_client_698e0055-22f8-4a3b-a2c8-eb476975de7b.sh 
-rwxrwx---  1 ijeff  wheel  924 Dec  9 05:48 /var/run/rsync_client_698e0055-22f8-4a3b-a2c8-eb476975de7b.sh
And it modifies my personal crontab file:

Code: Select all

[ijeff@nas4free /var/run]$ crontab -l
SHELL=/bin/ti
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
HOME=/var/log
#
#minute	hour	mday	month	wday	who	command
#
30 6 * * * /var/run/rsync_client_698e0055-22f8-4a3b-a2c8-eb476975de7b.sh
* * * * * /mnt/Pool1b/DS2Z/home/ijeff/bin/touchme
2,20 * * * * /mnt/Pool1b/DS2Z/home/ijeff/bin/rsyncwebcams
This all makes eminent sense so far but trying to run the file at the command line produces errors:

Code: Select all

[ijeff@nas4free /var/run]$ ./rsync_client_698e0055-22f8-4a3b-a2c8-eb476975de7b.sh 
touch: /var/run/rsync_client_running_698e0055-22f8-4a3b-a2c8-eb476975de7b: Permission denied
sending incremental file list
rsync: change_dir "/var/run//myhost.mydomain.com//files2/IGJShared/webcams" failed: No such file or directory (2)

sent 20 bytes  received 12 bytes  64.00 bytes/sec
total size is 0  speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1165) [sender=3.1.1]
I don’t recall mentioning /var/run in my configuration :( . Anyway digging into the script it seems that whatever generates the script has a typo. Line 10 reads:

Code: Select all

"myhost.mydomain.com//files2/IGJShared/webcams/webcam3" "/mnt/Pool1b/DS2Z/backup/myhost/webcams/webcam3/"
But it should read:

Code: Select all

"myhost.mydomain.com:/files2/IGJShared/webcams/webcam3" "/mnt/Pool1b/DS2Z/backup/myhost/webcams/webcam3/"
And indeed changing the / to a : does fix the script and it runs fine with one non fatal error:

Code: Select all

touch: /var/run/rsync_client_running_698e0055-22f8-4a3b-a2c8-eb476975de7b: Permission denied
receiving file list ... done
webcam3/
webcam3/2015-11-27-181003_webcam3.jpg
webcam3/2015-11-27-181503_webcam3.jpg
webcam3/2015-11-27-182001_webcam3.jpg
webcam3/2015-11-27-182507_webcam3.jpg
webcam3/2015-11-27-183002_webcam3.jpg

Here’s the full script:

Code: Select all

#!/bin/sh
/usr/bin/logger -p local4.notice "Start of remote RSYNC synchronization from /files2/IGJShared/webcams/webcam3 on myhost.mydomain.com to /mnt/Pool1b/DS2Z/backup/myhost/webcams/webcam3/"
if [ -r /var/run/rsync_client_running_698e0055-22f8-4a3b-a2c8-eb476975de7b ]; then
/usr/bin/logger -p local4.notice "Previous client synchronization still running... exiting"
exit
fi
/usr/bin/touch /var/run/rsync_client_running_698e0055-22f8-4a3b-a2c8-eb476975de7b
/usr/local/bin/rsync --log-file=/var/log/rsync_client.log --recursive --times --compress --archive -v "myhost.mydomain.com//files2/IGJShared/webcams/webcam3" "/mnt/Pool1b/DS2Z/backup/myhost/webcams/webcam3/"
/bin/rm -f /var/run/rsync_client_running_698e0055-22f8-4a3b-a2c8-eb476975de7b
/usr/bin/logger -p local4.notice "End of remote RSYNC synchronization from /files2/IGJShared/webcams/webcam3 on myhost.mydomain.com to /mnt/Pool1b/DS2Z/backup/myhost/webcams/webcam3
Here’s the configuration for rsync from config.xml

Code: Select all

       <rsync>
                <rsyncclient>
                        <enable/>
                        <uuid>698e0055-22f8-4a3b-a2c8-eb476975de7b</uuid>
                        <rsyncserverip>myhost.mydomain.com</rsyncserverip>
                        <minute>30</minute>
                        <hour>6</hour>
                        <day></day>
                        <month></month>
                        <weekday></weekday>
                        <localshare>/mnt/Pool1b/DS2Z/backup/myhost/webcams/webcam3/</localshare>
                        <remoteshare>/files2/IGJShared/webcams/webcam3</remoteshare>
                        <all_mins>0</all_mins>
                        <all_hours>0</all_hours>
                        <all_days>1</all_days>
                        <all_months>1</all_months>
                        <all_weekdays>1</all_weekdays>
                        <description>test of webcam3 rsync</description>
                        <who>ijeff</who>
                        <options>
                                <recursive/>
                                <nodaemonreq/>
                                <times/>
                                <compress/>
                                <archive/>
                                <delete_algorithm>default</delete_algorithm>
                                <extraoptions>-v</extraoptions>
                        </options>
                </rsyncclient>
        </rsync>
NAS4Free 10.3.0.3 (2617)
Intel Corporation D525MW 4GB
Promise SATA 300 TX4
HGST HTS721010A9E630 X 3 TOSHIBA MQ01ABD100 x2 + spare ZFS R5

ijeffsc
Starter
Starter
Posts: 23
Joined: 05 Dec 2015 13:11
Location: NY, ON, Krabi Thailand
Status: Offline

Re: rsync and cron #2

Post by ijeffsc »

submitted as bug #284 after debugging my sourceforge account (LOL).
NAS4Free 10.3.0.3 (2617)
Intel Corporation D525MW 4GB
Promise SATA 300 TX4
HGST HTS721010A9E630 X 3 TOSHIBA MQ01ABD100 x2 + spare ZFS R5

ijeffsc
Starter
Starter
Posts: 23
Joined: 05 Dec 2015 13:11
Location: NY, ON, Krabi Thailand
Status: Offline

Re: rsync and cron #2

Post by ijeffsc »

Corrected in 10.3 thanks to dev team.
NAS4Free 10.3.0.3 (2617)
Intel Corporation D525MW 4GB
Promise SATA 300 TX4
HGST HTS721010A9E630 X 3 TOSHIBA MQ01ABD100 x2 + spare ZFS R5

Post Reply

Return to “RSYNC”