From owner-freebsd-questions Mon May 6 12:32:26 2002 Delivered-To: freebsd-questions@freebsd.org Received: from infinity.aesredfish.net (ns1.aesredfish.net [65.168.0.12]) by hub.freebsd.org (Postfix) with ESMTP id 4E9DB37B409 for ; Mon, 6 May 2002 12:32:19 -0700 (PDT) Received: from potentialtech.com (mhope-dhcp-65-168-1-181.dashfast.com [65.168.1.181]) by infinity.aesredfish.net (8.11.6/8.11.0) with ESMTP id g46JW7U17510; Mon, 6 May 2002 15:32:08 -0400 Message-ID: <3CD6DB71.2050603@potentialtech.com> Date: Mon, 06 May 2002 15:37:21 -0400 From: Bill Moran Organization: Potential Technologies User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.0rc1) Gecko/20020502 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Steve Bertrand Cc: freebsd-questions@freebsd.org Subject: Re: Backup script.. References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Steve Bertrand wrote: > I spent all weekend documenting and securing my network which contains 3 > FreeBSD servers. My internal network server which is a PDC running Samba is > being used as a central backup controller. I have written crontabs for all > of the BSD servers to collect all critical config files and store them in a > backup directory for the backup controller to collect later using scp for > dumping to tape. > > Although I have been able to automate 90% of this operation, I would like to > have each server check to see if the directory containing it's backup has > changed since the previous backup 24 hours earlier, if not, skip the backup. > I am off site right now, so this may not be exactly what I was working with, > and this is not my entire backup script, just the test section for comparing > sizes You may have much better luck with rsync, which is in the ports. It should handle a lot of this for you automagically, and when things do change, it will only copy the changes, not entire files and/or directories. You'll be able to do everything you do below with a one-line script. I've used it for quite a while with zero problems. > > ####################### > #`snip from backup script //testing only > #!/bin/sh > > size1=`du -s /tmp/svr3bkp` > size2=`du -s /path/to/live/dir` > overall='$size1 = $size2' /* am I using the proper 'equal to' operand here? > */ > > if ! [ $overall] > then > dosomething > else > dosomethingelse > fi > > ################## > > I get an error to the effect of 'Command not found' or similar. > Am I on the right track? I used to do some C++ programming and find this to > be very similar, but I still need to get used to some of the operators and > how to implement commands into the script. As far as I remember, == would > be the 'equal to' operand, but I can't find documentation to state > otherwise. > > Are there commands used to test the differences in file/dir sizes or mod > dates that I can use as a conditional to perform other commands? > > Tks, > > Steve > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > > -- Bill Moran Potential Technology http://www.potentialtech.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message