?
Solved

Backup Shell Scripting

Posted on 2003-03-24
6
Medium Priority
?
251 Views
Last Modified: 2013-12-27
I wish to run a daily backup job. I need help with the scripting part. Can someone give me the script to ONLY backup files that have been modified or created today. Lets take for example we want to implement it on these folders
/user1/
/user2/
/user3/
So we need to check out each file in these folders to know which file to save. Need it real urgent ! Preferably that complete script.
0
Comment
Question by:kohdavid
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
6 Comments
 
LVL 18

Accepted Solution

by:
liddler earned 152 total points
ID: 8193915
Assuming you use tar to backup:

#!/bin/ksh
filelist=`find /user[1-3] -mtime -1`
tar cv $filelist



it uses single back inverted commas (`) to pass the result of the find command to filelist
the user[1-3] expands to /users1 /users2 /users3
-mtine -1 is modified in the last day

HTH
0
 
LVL 5

Assisted Solution

by:ecw
ecw earned 148 total points
ID: 8194563
yes but, filelist max exec ARGSMAX (ie. argument list too long), plus if a directory has changed, tar will backup everything beneath that directory.

I suggest using cpio

find /user[1-3] -mtime -1 | cpio -ocv > /dev/rmt/0m
0
 
LVL 18

Expert Comment

by:liddler
ID: 8194968
we can backup just files, instead of directories etc with
find /user[1-3] -type f -mtime -1
0
 
LVL 1

Expert Comment

by:SumeshDaftary
ID: 8195608
I think you will find your answer here.

http://www.sun.com/bigadmin/scripts/indexBackup.html
0
 
LVL 18

Expert Comment

by:liddler
ID: 10476772

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Points split liddler & ecw

Please leave any comments here within the next four days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

liddler
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses
Course of the Month9 days, 4 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question