Help :Backing up a file system

     I was wondering if someone could share some backup scripts with me. Actually I want to back up the /usr/local file system everyday at a particular time(midnight). I want it to backed up  if any changes have been made on the /usr/local file system. ( I believe this is an incremental backup ). Can someone please tell me the cron script in order to do this and where will I have to add this entry( the file ?? )

Waiting for a response.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

put your script into a crontab file (prefered roots crontab).
How to do this depends on your OS. The crontab file should contain somthing like:

59 23 * * *  path_of_your_script

your script may look like this:

cd /usr/local
tar cvf /dev/tape `find . anewer backup.timestamp -print`
touch backup.timestamp

NOTE that tar just copies to your tape. If this should be incremental, the tape must be possitioned at the end. This usually depends on your device.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jmahtaniAuthor Commented:
         Thanks for replying. I was wondering if you could tell me how to do it by using ufsdump, rather then tar. I believe that by using ufsdump, one can back up only the changes that have been made since the previous day.
Waiting for your response.
By the way, I am using solaris 2.5.1
To use ufsdump you just need to use the command:

ufsdump 1uf /dev/rmt/0 /usr/local

The number "1" specifies what level the dump is.  Level 0 is
a full level dump.  The "u" flag tells ufsdump to update the
dumpdate file so it knows what timestamp to check against for
file changes.
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

I made a general purpose suggestion, not limited to any UNIX flaviour ;-)

You're lucky if your Solaris can do it that simple way (ufsdump).
jmahtaniAuthor Commented:
      I have added the following statement to the root crontab ( /var/spool/cron/crontabs/root ), but at 15:15, it does not dump the /usr/local filesystem.
15 15 * * * /usr/sbin/ufsdump 1uf /dev/rmt/0 /dev/rdsk/c1t1d0s7
Can someone please tell me whats going on ???
Waiting for your response.

The following are the contents of the root crontab file :
#ident  "@(#)root       1.12    94/03/24 SMI"   /* SVr4.0       */
# The root crontab should be used to perform accounting data collection.
# The rtc command is run to adjust the real time clock if and when
# daylight savings time changes.
0 2 * * 0,4 /etc/cron.d/logchecker
5 4 * * 6   /usr/lib/newsyslog
15 3 * * * /usr/lib/fs/nfs/nfsfind
1 2 * * * [ -x /usr/sbin/rtc ] && /usr/sbin/rtc -c > /dev/null 2>&1
15 15 * * * /usr/sbin/ufsdump 1uf /dev/rmt/0 /dev/rdsk/c1t1d0s7          

Did you just add this with an editor? Probably you need a special command to edit the crontab files (crontab, cronvi, ..) or your crond must be informed that something changed: send a HUP signal or kill it and restart.
jmahtaniAuthor Commented:
I did reboot the system after adding the entry to the cron. So, the crond must have read the entries once again.
Also, when the system was rebooting, it displayed a message something like %root is no user, cron entry not created
Any suggestions ??
> cron entry not created
check your var/adm/{messages,syslog} if there is more information
you also need to read your man-pages about cron, crontab etc. (sorry I don't have them available)
jmahtaniAuthor Commented:
         Its working. I checked up the /etc/dumpdates file and it had dumped it at the time that I had specified in the root crontab file.
That's what e-e is for ;-)
Thanks for grading.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.