Sponsored Content
Full Discussion: Backups using rsync
Top Forums Shell Programming and Scripting Backups using rsync Post 302786389 by dpatino on Wednesday 27th of March 2013 11:08:47 AM
Old 03-27-2013
Backups using rsync

Hello all,

I'm using nas4free as a SAN and am having troubles getting a backup of it's data to work properly. I've posted in the nas4free forums, but haven't received much help.

Here is the code I'm using:

Code:
#!/bin/sh
{
#########################################################################################
# File:    casedatabackup.sh
# Author:    Daryl Patino
# Date:   03-18-2013
# Purpose:   Daily incremental backups and weekly archive of backups using rsync
#
# 
# Important Usage Notes:
# -cp this file with a different name to retain this file as a template
# -edit logfilename located in BODY variable and end of script to match share
# -view existing scripts for examples
# -end all directory variables with /
# -must run the following command on the file "chmod u+x /path/file"
#########################################################################################


#########################################################################################
# Constant variables, do not change
#########################################################################################

DAY=$(date +%A)
DATE=$(date +%m_%d_%y)
PRINTF=/usr/bin/printf
MSMTP=/usr/local/bin/msmtp
MSMTPCONF=/var/etc/msmtp.conf


#########################################################################################
# Dynamic variables, changeable
#########################################################################################

# Mail settings
FROM="nas4free@usinfosec.com"
TO="helpdesk@usinfosec.com"
MDIR="CaseData"
SUBJECT="$MDIR Backup Report"
BODY="$(cat /mnt/support/logs/casedata.log)"

# Sync settings
RSOURCE="/mnt/POOL/CaseData/"
RDEST="/mnt/syl-s-012/Backups/CaseData/Daily/"
ASOURCE=$RDEST
ADEST="/mnt/syl-s-012/Backups/CaseData/Weekly/"


#########################################################################################
# Backup operations
#########################################################################################

# Daily file sync
rsync -a --stats $RSOURCE $RDEST

# Weekly archive and follow up sync to remove deleted files
if [ $day = "Sunday" ]; then
   tar -zcf $ADEST$DATE.tar.gz $ASOURCE
   rsync -a --delete --stats $RSOURCE $RDEST
   find $ADEST -mtime +14 -exec rm {} \;
fi

# Sends email of log file
$PRINTF "From:$FROM\nTo:$TO\nSubject:$SUBJECT\n\n$BODY" | $MSMTP --file=$MSMTPCONF -t

} > /mnt/support/logs/casedata.log

It is scheduled to run as a cron once per day via the nas4free gui. The script runs, and the daily rsync works, but the log file is empty and the weekly commands (in the if statement) do not seem to be working. When I run the tar individually, I get the following:

Quote:
syl-s-030:~# tar -zcfv /mnt/syl-s-012/Backups/CaseData/Weekly/date.tar.gz /mnt/syl-s-012/Backups/CaseData/Daily/
tar: Removing leading '/' from member names

/: write failed, filesystem is full
tar: Write error
I know that the embedded nas4free doesn't have room to install any additional applications, but the source and destination are mounted shares.

So my questions are this.

Does tar use some kind of temp directory that is local? If so, can it be changed?

My logging syntax might be incorrect. If so, how can I create a log of the scripts output that can be emailed?
 

10 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

Backups

I have been using the hostdump.sh backup script for over a year now and have recently run into a problem. I'm now getting the following error at the end of my jobs; /bin/mt -f: error fsf'ing tape. This script uses the native 'ufsdump'. So, I try to go back and read the last dump on the tape... (11 Replies)
Discussion started by: Solaris
11 Replies

2. UNIX for Dummies Questions & Answers

backups

When using hostdump.sh to backup a system I can do it fine. But how can I restore what I backuped up? :) Thx in advance (2 Replies)
Discussion started by: merlin
2 Replies

3. UNIX for Advanced & Expert Users

UNIX backups

hi, how do we go for the BACK UPS on the UNIX box,using DLT tapes.i need to back up the stuff on the DLT tape. pls HELP:( (4 Replies)
Discussion started by: saood
4 Replies

4. UNIX for Dummies Questions & Answers

Backups.

Hello everyone my ? is about backups. I'am running SCO OS 505 and currently backing up the hole HD. Well the back up is taking too long and this is becoming a problem for the users since we are a 24-7 bussines, I whant stop backing up every thing on the HD. What are the most important files and... (1 Reply)
Discussion started by: kikkin
1 Replies

5. UNIX for Advanced & Expert Users

backups in background

Hi, how i can do background backup process in Unix?? I has Solaris Operating System. very much thanks!! (4 Replies)
Discussion started by: jairog
4 Replies

6. UNIX Desktop Questions & Answers

Backups too CD

I've been handed the task of backing up some of our system files on a Solaris box. No probs. Zipped the logs that needed backing up but my superiors do not want it on tape, they want it spanned on CD's. The CD-Writer is available on a MS box. FTP'd the zipped logs across too the MS Machine but now... (1 Reply)
Discussion started by: mccrack_2003
1 Replies

7. Shell Programming and Scripting

Rsync Scripts for Offsite backups

I am currently bringing up an offsite location, right now I am in the process of copying some data offsite (about 400GB). The problem I see is that running a single rsync for everything is not using the available bandwidth and testing shows that I double in speed for each instance of Rsync I am... (3 Replies)
Discussion started by: mchasse
3 Replies

8. UNIX for Advanced & Expert Users

Rsync Backups on HostGator VPS

I'm wanting to do remote backups of the entire /home/* directory structure, which is where HG puts all www files and sets the user and group independently of any other user ( so /home/user1 will be using group user1, instead of a generic apache group) The problem I'm running into is that only... (0 Replies)
Discussion started by: kettlewell
0 Replies

9. AIX

AIX 6.1 Backups

Hello, I've got multiple AIX LPARs running on VIOS, within a blade environment. I need to dump a mksysb backup to backup rootvg and a couple of other volume groups. mksysb -i "destination"; works however I'd like to make sure its being done correctly. on the other volume groups, ive... (2 Replies)
Discussion started by: ollie01
2 Replies

10. Shell Programming and Scripting

Rsync Error: rsync: link_stat failed: No such file or directory (2)

I wish to copy all the files & folder under /web/Transfer_Files/data/ on mymac1 (Linux) to remote server mybank.intra.com (Solaris 10) /tmp/ location I am using Ansible tool synchronize module which triggers the unix rsync command as below:rsync --delay-updates -F --compress --archive --rsh=ssh... (2 Replies)
Discussion started by: mohtashims
2 Replies
svn-fast-backup(1)					      General Commands Manual						svn-fast-backup(1)

NAME
svn-fast-backup - very fast backup for Subversion fsfs repositories. SYNOPSIS
svn-fast-backup [-q] [-k{N|all}] [-f] [-t] [-s] repos_path backup_dir DESCRIPTION
svn-fast-backup uses rsync snapshots for very fast backup of a Subversion fsfs repository at repos_path to backup_dir/repos-rev, the latest revision number in the repository. Multiple fsfs backups share data via hardlinks, so old backups are almost free, since a newer revision of a repository is almost a complete superset of an older revision. This is good for replacing incremental log-dump+restore-style backups because it is just as space-conserving and even faster; there is no inter-backup state (old backups are essentially caches); each backup directory is self-contained. It has the same command-line interface as svn-hot-backup(1) (if you use --force), but only works for fsfs repositories. svn-fast-backup keeps 64 backups by default and deletes backups older than these; this can be adjusted with the -k option. OPTIONS
-h, --help Shows some brief help text. -q, --quiet Quieter-than-usual operation. -k, --keep=N Keep a specified number of backups; the default is to keep 64. -k, --keep=all Do not delete any old backups at all. -f, --force Make a new backup even if one with the current revision exists. -t, --trace Show actions. -s, --simulate Don't perform actions. AUTHOR
Voluntary contributions made by many individuals. Copyright (C) 2006 CollabNet. 2006-11-09 svn-fast-backup(1)
All times are GMT -4. The time now is 06:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy