Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Backup Shell Scripting

Posted on 2003-03-24
6
Medium Priority
?
259 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
  • 3
5 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
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…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses
Course of the Month10 days, 18 hours left to enroll

571 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