cron rsync back up weewx

372 views
Skip to first unread message

vigilancewx

unread,
Jun 12, 2014, 7:39:46 PM6/12/14
to weewx...@googlegroups.com

I am trying to back my Weewx directory to a usb drive

If I run the following from the command line it works

sudo rsync -razv  /home/weewx /mnt/usbdrive/$(/bin/date +%m.%d.%Y)

if try to run it as a cron task it fails

 

so I tried to run a more simple cron task

rsync –av /home/weewx/public_html/Dave.html /home/myideas 

 

fails again with
Jun 12 23:56:04 raspberrypi weewx[2311]: cheetahgenerator: generated 13 'ToDate' files for StandardReport in 37.48 seconds
Jun 12 23:56:12 raspberrypi weewx[2311]: genimages: Generated 17 images for StandardReport in 7.63 seconds
Jun 12 23:56:12 raspberrypi weewx[2311]: reportengine: copied 0 files to /home/weewx/public_html
Jun 12 23:56:12 raspberrypi weewx[2311]: reportengine: Running report FTP
Jun 12 23:56:12 raspberrypi weewx[2311]: reportengine: Found configuration file /home/weewx/skins/Ftp/skin.conf for report FTP
Jun 12 23:56:12 raspberrypi weewx[2311]: reportengine: FTP upload not requested. Skipped.
Jun 12 23:56:12 raspberrypi weewx[2311]: reportengine: Running report RSYNC
Jun 12 23:56:12 raspberrypi weewx[2311]: reportengine: Found configuration file /home/weewx/skins/Rsync/skin.conf for report RSYNC
Jun 12 23:56:12 raspberrypi weewx[2311]: reportengine: rsync upload not requested. Skipped.
Jun 12 23:56:38 raspberrypi crontab[10007]: (pi) REPLACE (pi)
Jun 12 23:56:38 raspberrypi crontab[10007]: (pi) END EDIT (pi)
Jun 12 23:57:01 raspberrypi /usr/sbin/cron[2135]: (pi) RELOAD (crontabs/pi)
Jun 12 23:57:01 raspberrypi /USR/SBIN/CRON[10013]: (pi) CMD (sudo rsync \342\200\223av /home/weewx/public_html/Dave.html /home/myideas )
Jun 12 23:57:01 raspberrypi /USR/SBIN/CRON[10012]: (CRON) info (No MTA installed, discarding output)
Jun 12 23:58:01 raspberrypi /USR/SBIN/CRON[10021]: (pi) CMD (sudo rsync \342\200\223av /home/weewx/public_html/Dave.html /home/myideas )
Jun 12 23:58:01 raspberrypi /USR/SBIN/CRON[10020]: (CRON) info (No MTA installed, discarding output)
Jun 12 23:58:40 raspberrypi crontab[10026]: (pi) BEGIN EDIT (pi)
Jun 12 23:58:59 raspberrypi crontab[10026]: (pi) END EDIT (pi)
Jun 12 23:59:01 raspberrypi /USR/SBIN/CRON[10031]: (pi) CMD (sudo rsync \342\200\223av /home/weewx/public_html/Dave.html /home/myideas )
Jun 12 23:59:02 raspberrypi /USR/SBIN/CRON[10030]: (CRON) info (No MTA installed, discarding output)
Jun 12 23:59:09 raspberrypi crontab[10036]: (pi) BEGIN EDIT (pi)
Jun 12 23:59:33 raspberrypi crontab[10036]: (pi) REPLACE (pi)
Jun 12 23:59:33 raspberrypi crontab[10036]: (pi) END EDIT (pi)
Jun 13 00:00:01 raspberrypi /usr/sbin/cron[2135]: (pi) RELOAD (crontabs/pi)
Jun 13 00:00:17 raspberrypi weewx[2311]: Archive: added archive record 2014-06-13 00:00:00 BST (1402614000)
Jun 13 00:00:17 raspberrypi weewx[2311]: forecast: MainThread: WU: not yet time to do the forecast
Jun 13 00:00:17 raspberrypi weewx[2311]: forecast: MainThread: XTide: not yet time to do the forecast
Jun 13 00:00:17 raspberrypi weewx[2311]: reportengine: Running reports for latest time in the database.
Jun 13 00:

if I run the cron task as

sudo cp /home/weewx/public_html/Dave.html /home/myideas


it works?


so why is rsync not allowing the cron task to run ?


any ideas ?

thanks for any help



 

vds

unread,
Jun 13, 2014, 2:05:35 AM6/13/14
to weewx...@googlegroups.com
EIther a permission thing, or you're writing to a subdirectory that doesn't exist, or both.

You can debug it by running the command, and checking the command exit status (echo $?) which should be zero if it worked and non-zero if it failed.  If it is non-zero you would then look up the exit status in the /usr/include tree. Since you're on a Pi, I'll assume you're running Raspbian, meaning the file to look at is /usr/include/asm-generic/errno-base.h

I find it a little hard to believe that the rsync command you ran from the shell didn't return anything at all.  What you provided was a syslog snippet, not the rsync command writing its thing to standard error (ie, the shell you typed it in).

(example with no read permission) 
rsync -av /root/foobar /tmp/foobar
sending incremental file list
rsync: change_dir "/root" failed: Permission denied (13)

sent 12 bytes  received 12 bytes  48.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(1070) [sender=3.0.9]


(example with no write permission)
 rsync -av /etc/motd /root/foobar
sending incremental file list
rsync: ERROR: cannot stat destination "/root/foobar": Permission denied (13)
rsync error: errors selecting input/output files, dirs (code 3) at main.c(583) [Receiver=3.0.9]
rsync: connection unexpectedly closed (9 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [sender=3.0.9]

It seems like rsync returns some strange error codes, but it generally tells you what's going on pretty clearly as the examples above should illustrate.
 

vigilancewx

unread,
Jun 13, 2014, 1:45:05 PM6/13/14
to weewx...@googlegroups.com

Hi thanks for your comments

 

Where is the log file

I looked /usr/include/asm-generic/errno-base.h

Yes I have a pi running raspbian

I looked in the errno-base.h

#ifndef _ASM_GENERIC_ERRNO_BASE_H

#define _ASM_GENERIC_ERRNO_BASE_H

 

#define EPERM           1      /* Operation not permitted */

#define ENOENT          2      /* No such file or directory */

#define ESRCH           3      /* No such process */

#define EINTR           4      /* Interrupted system call */

#define EIO             5      /* I/O error */

#define ENXIO           6      /* No such device or address */

#define E2BIG           7      /* Argument list too long */

#define ENOEXEC         8      /* Exec format error */

#define EBADF           9      /* Bad file number */

#define ECHILD          10      /* No child processes */

#define EAGAIN          11      /* Try again */

#define ENOMEM          12      /* Out of memory */

#define EACCES          13      /* Permission denied */

#define EFAULT          14      /* Bad address */

#define ENOTBLK         15      /* Block device required */

#define EBUSY           16      /* Device or resource busy */

#define EEXIST          17      /* File exists */

#define EXDEV           18      /* Cross-device link */

#define ENODEV          19      /* No such device */

#define ENOTDIR         20      /* Not a directory */

#define EISDIR          21      /* Is a directory */

#define EINVAL          22      /* Invalid argument */

#define ENFILE          23      /* File table overflow */

#define EMFILE          24      /* Too many open files */

#define ENOTTY          25      /* Not a typewriter */

#define ETXTBSY         26      /* Text file busy */

#define EFBIG           27      /* File too large */

#define ENOSPC          28      /* No space left on device */

#define ESPIPE          29      /* Illegal seek */

#define EROFS           30      /* Read-only file system */

#define EMLINK          31      /* Too many links */

#define EPIPE           32      /* Broken pipe */

#define EDOM            33      /* Math argument out of domain of func */

#define ERANGE          34      /* Math result not representable */

 

#endif

 

 

Looks error codes not logs

The directory I am copying to does not have any read or write restrictions

Thanks again for your help

vds

unread,
Jun 13, 2014, 3:42:51 PM6/13/14
to weewx...@googlegroups.com
You need to 'do' what I asked for me to help.

Run the rsync command that failed.  Be sure to include the -v (verbose) switch.  It will either tell you verbosely that it worked, or tell you verbosely that it failed (and why).  There are no logs involved when you run from the command line.

If you do this, perhaps I can help.  If you don't, then there's nothing I can do for you.

vigilancewx

unread,
Jun 13, 2014, 6:10:29 PM6/13/14
to weewx...@googlegroups.com
Hi

Yes your correct its a permissions issue

-v switch reveals all

usb was Fat 32 format

quick search on google

needs to be NTFS or ext3/4

once more thanks for your help

On Friday, June 13, 2014 12:39:46 AM UTC+1, vigilancewx wrote:

Michiel Kanis

unread,
Nov 27, 2014, 7:05:10 AM11/27/14
to weewx...@googlegroups.com
Hi,

Maybe stupid question but when I log in as root on my Raspberry pi with working weewx environment and I run the following command: rsync -avz -e ssh /home/weewx/public_html/ ro...@192.168.178.10:/volume1/web/weather/ the incremental file list is copied to my NAS server without any error. It took some time to understand and implement the Rsync id_rsa.pub. Could you let me know how I can use this command in the weewx environment so Rsync will automatically synchronise my website to my synology webserver?

Thanks in advanced

Michiel

Op vrijdag 13 juni 2014 08:05:35 UTC+2 schreef vds:

vds

unread,
Nov 27, 2014, 3:23:01 PM11/27/14
to weewx...@googlegroups.com

It's pretty well documented in the comments in weewx.conf - edit your values into the [[RSYNC]] section, stop/restart weewx, watch your syslog and see it work hopefully. 

Setting debug=1 might help initially if you don't run with weewx debugging enabled already.


mka...@gmail.com

unread,
Nov 28, 2014, 2:00:27 AM11/28/14
to weewx...@googlegroups.com
Thanks for your reply.

I works now!!! Just telling me rsynced 57 files.

Regards Michiel



Verzonden met Windows Mail

--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/187ovR3jmW0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages