Sponsored Content
Top Forums UNIX for Advanced & Expert Users Advice on a backup script, maybe one is out there already? Post 302987483 by jim mcnamara on Saturday 10th of December 2016 10:48:51 AM
Old 12-10-2016
There seems to be a misunderstanding. A backup means an exact copy, not a parallel copy. Plus if the data is important, consider getting the backup onto separate media as well.

Why: 'restore a backup' means extracting the backup file into many correctly named files. Correctly named includes the path name. Your backups all have files with the wrong name, unless - to restore - you want to unpack the tarball, then manually copy each file back where it came from.

Not that this will not work. It is duplicated effort and wastes disk space - you actually have 3 copies of each file.

Code:
tar cvfz /path/to/backup/backup_`date +%Y%m%d`.tar.gz /u01/db/mysql

This creates a backup file with the backup date as part of the name, already compressed, on whatever device you choose to place it. Suppose someone then accidentally trashes a file, /u01/db/mysql/scripts/foo.ksh. So. You want to restore it to the way it was before it got munged:
choose the date you want to restore back to, say 20161201. - Dec 1, 2106
Code:
cd /u01/db/mysql/scripts
tar xvfz /path/to/backup/backup_20161201.tar.gz /u01/db/mysql/scripts/foo.shl .

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

c-shell script advice please.

Hi, I have the following script running in my cron. -------------------------------------------------------------------- #!/bin/csh bnstat -p GPD_VSLinux | grep pg | grep varcon | awk '{print $1, $2, $3, $4, $5, $6, $7, $8, $9, $10}' > /tmp/LX_xbatch.log bnstat -p GPD_VSLinux_test | grep pg... (2 Replies)
Discussion started by: killerserv
2 Replies

2. UNIX for Dummies Questions & Answers

Backup help/advice using TAR

Every day we back up all files on our system that are older than 7 days, so effectively we do a day's worth at a time. The way we do this is to issue a find command using mtime +7 - we then loop round and for each result we issue a MV to move the file to a newly created directory. We then TAR the... (20 Replies)
Discussion started by: tonysab
20 Replies

3. Shell Programming and Scripting

first script. need help and advice.

Hello everyone, This is my first post here and this is the first time I am using UNIX OS (Slackware). I find it really useful and powerful and would like to master it but as you may guess I am expreicing quite a few problems. I've been reading a few documentations about it and bash this week... (17 Replies)
Discussion started by: sanchopansa
17 Replies

4. Shell Programming and Scripting

Advice on Script

I would like some advice on how to logically put together a script to handle a daily task of data gathering for the following problem. I have two files, file1 has 125,000 records that I cut and remove unwanted fields through scripts and cron. In file2, I have 25000 records that has the same... (4 Replies)
Discussion started by: greengrass
4 Replies

5. Shell Programming and Scripting

Script Advice please?

Ok. I want to parse a log file and search only for denied traffic for the previous hour. The log looks like this: Jun 18 17:47:56 routername 36806: Jun 18 17:53:01.088: %SEC-6-IPACCESSLOG: list ingress-filter denied tcp 1.2.3.4(1234) -> 6.7.8.9(53), 4 packets I only really care about the... (12 Replies)
Discussion started by: earnstaf
12 Replies

6. Shell Programming and Scripting

Script Help/Advice

Alright, I feel like I have a pretty good basic knowledge of shell scripting, but this one is throwing me for a loop. I know I've seen something similar done with awk, but I couldn't find it with the search function. I've grepped through my log file and get results like this: --... (14 Replies)
Discussion started by: earnstaf
14 Replies

7. Filesystems, Disks and Memory

an advice regarding backup plan

Hi all i'm looking for good advice regarding backup plan becuase its first time to me handle large scale database expected to grow up 10000 - 20000 record per year with daily operations on it I'm working as sysAdmin in educational organization ( junior level ) with mixed OSes environment... (3 Replies)
Discussion started by: h@foorsa.biz
3 Replies

8. Shell Programming and Scripting

Advice on script

Hi folks, I use following script:- #!/bin/sh # cd Linbread TODAY=`date +"%m%d"` DATA=`grep $TODAY linbread.dat` HOUR=`date +"%H"` if then TOD="Morning" elif then TOD="Afternoon" else TOD="Evening" fi echo $DATA | gawk -F"|" '{printf("%s\n\n%s",$2,$3)}' > $$tmp fold -s -w60... (0 Replies)
Discussion started by: satimis
0 Replies

9. Shell Programming and Scripting

Script advice

All I have 2 parent directories - input and output. Each parent has multiple sub-directories...each sub-directory has multiple files. Each parent directory structure is a mirror image of itself I need to poll the imput directory and if a new file is found, encrypt the file, move the file to... (2 Replies)
Discussion started by: davidra
2 Replies

10. Shell Programming and Scripting

Help with Backup Shell Script for Network Device Configuration backup

HI all, im new to shell scripting. need your guidence for my script. i wrote one script and is attached here Im explaining the requirement of script. AIM: Shell script to run automatically as per scheduled and backup few network devices configurations. Script will contain a set of commands... (4 Replies)
Discussion started by: saichand1985
4 Replies
svn-backup-dumps(1)					      General Commands Manual					       svn-backup-dumps(1)

NAME
svn-backup-dumps - Create dumpfiles to backup a subversion repository. SYNOPSIS
svn-backup-dumps <repos> <dumpdir> DESCRIPTION
svn-backup-dumps creates dumpfiles from a subversion repository. It is intended for use in cron jobs and post-commit hooks. The basic modes of operation are: o Create a full dump (revisions 0 to HEAD) o Create incremental dump containing at most N revisions. o Create incremental single-revision dumps (for use in post-commit). Dumpfiles are named in the format basename.rev.svndmp or basename.rev.rev.svndmp, where basename is the repository directory name, and the rev arguments are the first and last revision numbers represented in the dumpfile, zero-padded to 6 digits. Optionally, svn-backup-dumps can compress dumpfiles with gzip or bzip2, and can transfer them to another host using FTP or SMB (using smb- client). OPTIONS
--version Show program's version number and exit. -h, --help Show this help message and exit. -b Compress the dump using bzip2. --deltas This is passed through to svnadmin dump. -c count Maximum number of revisions per dumpfile. -o Overwrite files. -O Overwrite all files. -q Quiet. -r rev Specify a single-revision dumpfile. -t ftp:host:user:password:path -t smb:share:user:password:path Transfer dumps to another machine using the FTP or SMB protocols. path is where to store the dumpfiles on the remote server; any occurrence of %r in the path is replaced by the repository name. Support for "smb:" requires the smbclient program. -z Compress the dump using gzip. EXAMPLES
To create a full dump of all revisions of a repository /srv/svn/foo in the directory /var/backup/svn: svn-backup-dumps /srv/svn/foo /var/backup/svn The dumpfile will be named src.000000-NNNNNN.svndmp.gz where NNNNNN is the head revision number. To create incremental dumps containing at most 1000 revisions: svn-backup-dumps --deltas -z -c 1000 /srv/svn/foo /var/backup/svn If the youngest revision is 2923, it creates the following files: foo.000000-000999.svndmp.gz foo.001000-001999.svndmp.gz foo.002000-002923.svndmp.gz If run again, later, when the youngest revision is 3045, it creates these two files: foo.002000-002999.svndmp.gz foo.003000-003045.svndmp.gz Note that it does not remove the redundant file foo.002000-002923.svndmp.gz. To create incremental single-revision dumps from a post-commit hook: svn-backup-dumps -r $rev $repos /var/backups/svn where $rev and $repos are variables previously set in the post-commit script from its command line. The dumpfile name will be in the form foo.000352.svndmp. To send the dumpfiles to the SMB share \ERNESTBACKUPS in a directory svnfoo with user svnuser and password w0rth1ng: svn-backup-dumps -t "smb://ERNEST/BACKUPS:svnuser:w0rth1ng:svn/%r /srv/svn/foo /tmp/tmpbackup Note that the %r in the path is replaced by the repository name foo. Note also that a local backup directory is required, at present, even when using the -t option. AUTHOR
Voluntary contributions made by many individuals. Copyright (C) 2006 CollabNet. 2006-11-09 svn-backup-dumps(1)
All times are GMT -4. The time now is 12:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy