[HOWTO] Daily incremental backup with rsnapshot
-
- Getting the hang of things
- Posts: 76
- Joined: Thu Mar 26, 2009 8:56 pm
Re: [HOWTO] Daily incremental backup with rsnapshot
Error messages are logged to the rsnapshot logfile. There is an example shell script to send job results to email here. I am not sure if this would work on a QNAP or not.
Maybe someone whose good at shell scripting could have a go at this
Maybe someone whose good at shell scripting could have a go at this
-
- Getting the hang of things
- Posts: 65
- Joined: Sun Nov 22, 2009 6:42 am
Re: [HOWTO] Daily incremental backup with rsnapshot
That's what I was going to do. The problem is that the QNAP doesn't have mail.
-
- Getting the hang of things
- Posts: 65
- Joined: Sun Nov 22, 2009 6:42 am
Re: [HOWTO] Daily incremental backup with rsnapshot
I think I figured out how to send email.... I am working on a script and will post what I get. Thus far...
Add the alias in to /etc/config/ssmtp/revaliases...
Then you can use ssmtp to send the mail... here is my test script...
Add the alias in to /etc/config/ssmtp/revaliases...
Code: Select all
admin:qnap@blah.com:mail.blah.com:25
Code: Select all
#!/bin/sh
# Header Stuff
MAILTO="admin@blah.com"
TO="Admin <admin@blah.com>"
FROM="QNAP <qnap@blah.com>"
SUBJECT="RSnapshot Log"
# Program
MAIL="/usr/sbin/ssmtp"
#logfile="/var/log/rsnapshot.log"
# Temporary Files MAILFILE="/tmp/TMPMAIL"
# Build Mail
echo "TO: $TO" > $MAILFILE
echo "FROM: $FROM" >> $MAILFILE
echo "SUBJECT: $SUBJECT" >> $MAILFILE
echo "" >> $MAILFILE
echo "Testing" >> $MAILFILE
# Send Mail
$MAIL $MAILTO < $MAILFILE
# Remove Temporary Files
rm -rf $MAILFILE
-
- Getting the hang of things
- Posts: 76
- Joined: Thu Mar 26, 2009 8:56 pm
Re: [HOWTO] Daily incremental backup with rsnapshot
Did you manage to get it to email error messages to you?
-
- Getting the hang of things
- Posts: 65
- Joined: Sun Nov 22, 2009 6:42 am
Re: [HOWTO] Daily incremental backup with rsnapshot
Yeah... if you do what I said above I got it to email out messages....
-
- Getting the hang of things
- Posts: 65
- Joined: Sun Nov 22, 2009 6:42 am
Re: [HOWTO] Daily incremental backup with rsnapshot
Got a script all done.... I have rsnapshot setup as per the guide.... and then ....
crontab:
/share/MD0_DATA/System/rsnapshot_log.sh:
I think it works.......
crontab:
Code: Select all
0 0 * * * /share/MD0_DATA/System/rsnapshot_log.sh
Code: Select all
#!/bin/sh
# Header Stuff
LOG_FILE="/opt/var/log/rsnapshot"
TMP_LOG_FILE="/tmp/rsnapshot_log.log"
MAIL_FILE="/tmp/rsnapshot_log.mail"
MAIL_TO="my@email.com"
MAIL_HEADER_TO="Me <my@email.com>"
MAIL_HEADER_FROM="QNAP <qnap@email.com>"
MAIL_HEADER_SUBJECT="RSnapshot Log"
MAIL="/usr/sbin/ssmtp"
# Extract Todays Log ( format 30/Mar/2006 )
fgrep `date +"%d/%b/%Y"` $LOG_FILE > $TMP_LOG_FILE
# Build Mail
{
echo "TO: $MAIL_HEADER_TO"
echo "FROM: $MAIL_HEADER_FROM"
echo "SUBJECT: $MAIL_HEADER_SUBJECT"
echo ""
echo "Backup Report on `date`"
egrep "completed|ERROR" $TMP_LOG_FILE
echo ""
echo "Disk Usage:"
/opt/bin/rsnapshot du
echo ""
/opt/bin/df -h
echo ""
echo "Full Log:"
echo ""
cat $TMP_LOG_FILE
} > $MAIL_FILE
# Send Mail
$MAIL $MAIL_TO < $MAIL_FILE
# Remove Temporary Files
rm -rf $MAIL_FILE $TMP_LOG_FILE
-
- Getting the hang of things
- Posts: 65
- Joined: Sun Nov 22, 2009 6:42 am
Re: [HOWTO] Daily incremental backup with rsnapshot
Whoops... log getter was wrong. Either need to update the script to grab yesterdays date... OR change the crontab to run BEFORE midnight...
Code: Select all
55 23 * * * /share/MD0_DATA/System/rsnapshot_log.sh
-
- New here
- Posts: 3
- Joined: Mon Jan 25, 2010 11:21 am
Re: [HOWTO] Daily incremental backup with rsnapshot
crushdepth, great job. Many thanks!
I do it successed on TS-459 pro for remote backup under your guide step by step.
I do it successed on TS-459 pro for remote backup under your guide step by step.
1xTS-809U-RP with 8x2T Disk,1xTS-459U with 4x2T Disk,1xTS-459U+ with 4x2T Disk, 1x3 x (TS-459pro with 4x2T Disk)
-
- Getting the hang of things
- Posts: 76
- Joined: Thu Mar 26, 2009 8:56 pm
Re: [HOWTO] Daily incremental backup with rsnapshot
Welcome
I hope one day rsnapshot will be included in the QNAP firmware. Being able to step back in time and recover a specific version of a file is extremely useful.
I hope one day rsnapshot will be included in the QNAP firmware. Being able to step back in time and recover a specific version of a file is extremely useful.
- Q
- Experience counts
- Posts: 1436
- Joined: Wed Sep 05, 2007 4:18 pm
- Location: Switzerland
- Contact:
Re: [HOWTO] Daily incremental backup with rsnapshot
+1!I hope one day rsnapshot will be included in the QNAP firmware. Being able to step back in time and recover a specific version of a file is extremely useful.
i also suggested this once to qnap... and adding a nice web ui for it would be even better. hope to see this or a similar function soon.
- Eduardo
- Easy as a breeze
- Posts: 350
- Joined: Tue Jun 30, 2009 2:08 am
- Location: Sevilla (Spain)
Re: [HOWTO] Daily incremental backup with rsnapshot
Using rsnapshot for the last two months. It works flawlessly.
I recovered an important file two weeks ago, and saved some hours of working.
Thanks to Crushdepth!
I recovered an important file two weeks ago, and saved some hours of working.
Thanks to Crushdepth!
TS-259Pro+,TS-239 Pro. Firm 3.7.3 Build0801
2xSeagate ST32000542AS CC34 Raid 1 (+1 ST32000542AS Raid 1 ESATA/USB Backup)
Qpkg: MLDonkey, JRE, Micke OpenSSH, Micke Nasreport, Python, CrashPlan, Rsnap.
Ipkg: Rsnapshot, logrotate, heyu
================================================================================================
Looking forward to a (Prolific 2303 or ftdi) USB to serial driver!
2xSeagate ST32000542AS CC34 Raid 1 (+1 ST32000542AS Raid 1 ESATA/USB Backup)
Qpkg: MLDonkey, JRE, Micke OpenSSH, Micke Nasreport, Python, CrashPlan, Rsnap.
Ipkg: Rsnapshot, logrotate, heyu
================================================================================================
Looking forward to a (Prolific 2303 or ftdi) USB to serial driver!
-
- Getting the hang of things
- Posts: 97
- Joined: Tue May 19, 2009 11:47 am
Re: [HOWTO] Daily incremental backup with rsnapshot
I'm having a bit of trouble setting up rsynch/rsnapshot. I have two servers QNAP1 and QNAP2. I have a directory in QNAP1 called DocumentControl. I am wanting this directory to get backed up daily and I am using the following backup command:
backup admin@qnap1:/DocumentControl/ DocumentControl/
When I run "rsnapshot daily" I get the following error:
rsync: link_stat "/DocumentControl" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1508) [Receiver=3.0.7]
Sure enough... if I use putty to log onto QNAP1 and do a "CD /DocumentControl", my directory is not there. Where is the DocumentControl directory actually located? I created it as a new folder off the root that is visible when using my browser (Internet Exporer) and going to \\qnap1 (the same place I see Public, Qdownload, Qrecordings, Qweb, etc).
Thank you.
****UPDATE****.... nevermind... I found it under SHARE.
backup admin@qnap1:/DocumentControl/ DocumentControl/
When I run "rsnapshot daily" I get the following error:
rsync: link_stat "/DocumentControl" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1508) [Receiver=3.0.7]
Sure enough... if I use putty to log onto QNAP1 and do a "CD /DocumentControl", my directory is not there. Where is the DocumentControl directory actually located? I created it as a new folder off the root that is visible when using my browser (Internet Exporer) and going to \\qnap1 (the same place I see Public, Qdownload, Qrecordings, Qweb, etc).
Thank you.
****UPDATE****.... nevermind... I found it under SHARE.
-
- Getting the hang of things
- Posts: 97
- Joined: Tue May 19, 2009 11:47 am
RE: Having trouble with backups...
Hi. I had rsnapshot configured with the following:
backup admin@qnap1:/share/DocumentControl/ DocumentControl/
I put a text file (text.txt) in my DocumentControl directory and ran "rsnapshot daily" I expected to see "daily.0/DocumentControl/text.txt" in my snapshots folder. Instead, I saw In my snapshots folder, I went to "daily.0/DocumentControl/share" and there was no "text.txt" file backed up.
I then tried the following with better results, but very deep nesting.
backup admin@qnap1:/share/MD0_DATA/DocumentControl/ QNAP1/
Doing this created the Text.TXT file in the following directory
\\qnap2\snapshots\daily.0\QNAP1\share\MD0_DATA\DocumentControl
Why do I have to use MD0_DATA when I can see the files when I go to /share/DocumentControl? Why does the backup contain "QNAP1\share\MD0_DATA\DocumentControl" directory instead of simply "DocumentControl"? I do understand that its giving the fully qualified path, but it's a lot of nesting that, I find to be inconvenient and unnecessary. Is there any way to prevent this?
Thanks.
backup admin@qnap1:/share/DocumentControl/ DocumentControl/
I put a text file (text.txt) in my DocumentControl directory and ran "rsnapshot daily" I expected to see "daily.0/DocumentControl/text.txt" in my snapshots folder. Instead, I saw In my snapshots folder, I went to "daily.0/DocumentControl/share" and there was no "text.txt" file backed up.
I then tried the following with better results, but very deep nesting.
backup admin@qnap1:/share/MD0_DATA/DocumentControl/ QNAP1/
Doing this created the Text.TXT file in the following directory
\\qnap2\snapshots\daily.0\QNAP1\share\MD0_DATA\DocumentControl
Why do I have to use MD0_DATA when I can see the files when I go to /share/DocumentControl? Why does the backup contain "QNAP1\share\MD0_DATA\DocumentControl" directory instead of simply "DocumentControl"? I do understand that its giving the fully qualified path, but it's a lot of nesting that, I find to be inconvenient and unnecessary. Is there any way to prevent this?
Thanks.
-
- Starting out
- Posts: 21
- Joined: Fri Feb 08, 2008 6:21 am
Re: [HOWTO] Daily incremental backup with rsnapshot
It is still hard to believe that Qnap hasnt implemented this realy crucial function
-
- Getting the hang of things
- Posts: 76
- Joined: Thu Mar 26, 2009 8:56 pm
Re: [HOWTO] Daily incremental backup with rsnapshot
Not that I know of. I think you need to use the fully qualified path, which includes MD0_DATA as you said.Why do I have to use MD0_DATA when I can see the files when I go to /share/DocumentControl? Why does the backup contain "QNAP1\share\MD0_DATA\DocumentControl" directory instead of simply "DocumentControl"? I do understand that its giving the fully qualified path, but it's a lot of nesting that, I find to be inconvenient and unnecessary. Is there any way to prevent this?