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
rsync_selinux(8)					rsync Selinux Policy documentation					  rsync_selinux(8)

NAME
rsync_selinux - Security Enhanced Linux Policy for the rsync daemon DESCRIPTION
Security-Enhanced Linux secures the rsync server via flexible mandatory access control. FILE_CONTEXTS SELinux requires files to have an extended attribute to define the file type. Policy governs the access daemons have to these files. If you want to share files using the rsync daemon, you must label the files and directories public_content_t. So if you created a special directory /var/rsync, you would need to label the directory with the chcon tool. chcon -t public_content_t /var/rsync To make this change permanent (survive a relabel), use the semanage command to add the change to file context configuration: semanage fcontext -a -t public_content_t "/var/rsync(/.*)?" This command adds the following entry to /etc/selinux/POLICYTYPE/contexts/files/file_contexts.local: /var/rsync(/.*)? system_u:object_r:publix_content_t:s0 Run the restorecon command to apply the changes: restorecon -R -v /var/rsync/ SHARING FILES
If you want to share files with multiple domains (Apache, FTP, rsync, Samba), you can set a file context of public_content_t and pub- lic_content_rw_t. These context allow any of the above domains to read the content. If you want a particular domain to write to the pub- lic_content_rw_t domain, you must set the appropriate boolean. allow_DOMAIN_anon_write. So for rsync you would execute: setsebool -P allow_rsync_anon_write=1 BOOLEANS
system-config-selinux is a GUI tool available to customize SELinux policy settings. AUTHOR
This manual page was written by Dan Walsh <dwalsh@redhat.com>. SEE ALSO
selinux(8), rsync(1), chcon(1), setsebool(8), semanage(8) dwalsh@redhat.com 17 Jan 2005 rsync_selinux(8)
All times are GMT -4. The time now is 05:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy