FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 12-22-2009, 02:22 AM
Dale
 
Default Writing a bash script or thinking about it anyway.

Hi folks,

Me again. I'm thinking about writing a bash script that backs up my
/home directory. I found a guide but before I read all that stuff and
muddy up the waters, is this thing current and will it work fine with
the bash Gentoo uses? Links to a even better guide would be good too.
The guide I found is here:


http://tldp.org/LDP/abs/html/

I'm going to try to do this myself but as most of you know, it takes me
a bit to grasp things. I may be back for advice on this as well. Who
knows, maybe one day I can be a dev. LOL Well, most likely not really
but anyway.


Thanks.

Dale

:-) :-)
 
Old 12-22-2009, 02:53 AM
Francisco Ares
 
Default Writing a bash script or thinking about it anyway.

I probably didn't get the point, but what about a simple "tar"?

#! /bin/bash
tar -cjvpf /tmp/home.tbz /home
mv /tmp/home.tbz /some/where/else

unless you're thinking on incremental back up, and more sophisticated things.

Francisco

On Tue, Dec 22, 2009 at 1:22 AM, Dale <rdalek1967@gmail.com> wrote:
> Hi folks,
>
> Me again. *I'm thinking about writing a bash script that backs up my /home
> directory. *I found a guide but before I read all that stuff and muddy up
> the waters, is this thing current and will it work fine with the bash Gentoo
> uses? *Links to a even better guide would be good too. *The guide I found is
> here:
>
> http://tldp.org/LDP/abs/html/
>
> I'm going to try to do this myself but as most of you know, it takes me a
> bit to grasp things. *I may be back for advice on this as well. *Who knows,
> maybe one day I can be a dev. *LOL *Well, most likely not really but anyway.
>
> Thanks.
>
> Dale
>
> :-) *:-)
>
>



--
"If you have an apple and I have an apple and we exchange apples then
you and I will still each have one apple. But if you have an idea and
I have one idea and we exchange these ideas, then each of us will have
two ideas." - George Bernard Shaw
 
Old 12-22-2009, 03:16 AM
Dale
 
Default Writing a bash script or thinking about it anyway.

Francisco Ares wrote:

I probably didn't get the point, but what about a simple "tar"?

#! /bin/bash
tar -cjvpf /tmp/home.tbz /home
mv /tmp/home.tbz /some/where/else

unless you're thinking on incremental back up, and more sophisticated things.

Francisco


Well, I want to start off making a small script. Maybe get a little
more complicated later on. I do want to do incremental backups, at
least at first. I may later on use tar and something to keep say two
copies and then delete the older ones.

Just trying to get my feet wet here. Trying to be simple at first and
go from there. If I try to cram to much in my head at one time, I get
brain lock.


Thanks.

Dale

:-) :-)
 
Old 12-22-2009, 03:32 AM
Francisco Ares
 
Default Writing a bash script or thinking about it anyway.

On Tue, Dec 22, 2009 at 2:16 AM, Dale <rdalek1967@gmail.com> wrote:
> Francisco Ares wrote:
>>
>> I probably didn't *get the point, but what about a simple "tar"?
>>
>> #! /bin/bash
>> tar -cjvpf /tmp/home.tbz /home
>> mv /tmp/home.tbz /some/where/else
>>
>> unless you're thinking on incremental back up, and more sophisticated
>> things.
>>
>> Francisco
>>
>>
>
> Well, I want to start off making a small script. *Maybe get a little more
> complicated later on. *I do want to do incremental backups, at least at
> first. *I may later on use tar and something to keep say two copies and then
> delete the older ones.
> Just trying to get my feet wet here. *Trying to be simple at first and go
> from there. *If I try to cram to much in my head at one time, I get brain
> lock.
>
> Thanks.
>
> Dale
>
> :-) *:-)
>
>

Well, there are a couple of tools to make your script quite simple:

http://www.linuxhowtos.org/Tips%20and%20Tricks/unison.htm
http://www.linuxjournal.com/article/7712
http://www.novell.com/coolsolutions/trench/16061.html
http://webtools.live2support.com/linux/rsync.php
http://www.linuxquestions.org/questions/linux-general-1/sync-a-usb-flash-drive-with-hd-folders-possible-522875/
http://www.linux.com/news/enterprise/storage/8200-back-up-like-an-expert-with-rsync
http://www.unixtutorial.org/2008/09/how-to-synchronize-directories-with-rsync/

Hope this helps
Francisco

--
"If you have an apple and I have an apple and we exchange apples then
you and I will still each have one apple. But if you have an idea and
I have one idea and we exchange these ideas, then each of us will have
two ideas." - George Bernard Shaw
 
Old 12-22-2009, 04:02 AM
Neil Walker
 
Default Writing a bash script or thinking about it anyway.

Dale wrote:
> Me again. I'm thinking about writing a bash script that backs up my
> /home directory.

I use a simple rsync cron job to backup entire servers every hour. Does
the job for me.


Be lucky,

Neil
http://www.the-workathome.com
 
Old 12-22-2009, 04:09 AM
Dale
 
Default Writing a bash script or thinking about it anyway.

Neil Walker wrote:

Dale wrote:


Me again. I'm thinking about writing a bash script that backs up my
/home directory.



I use a simple rsync cron job to backup entire servers every hour. Does
the job for me.


Be lucky,

Neil
http://www.the-workathome.com




But I wouldn't learn how to write a script that way. I got to start
somewhere. This is a good place.


Dale

:-) :-)
 
Old 12-22-2009, 09:34 AM
Jesús Guerrero
 
Default Writing a bash script or thinking about it anyway.

On Mon, 21 Dec 2009 21:22:05 -0600, Dale <rdalek1967@gmail.com> wrote:
> Hi folks,
>
> Me again. I'm thinking about writing a bash script that backs up my
> /home directory. I found a guide but before I read all that stuff and
> muddy up the waters, is this thing current and will it work fine with
> the bash Gentoo uses? Links to a even better guide would be good too.
> The guide I found is here:
>
> http://tldp.org/LDP/abs/html/

The advanced bash scripting guide will be equally valid nowadays as it was
when it was first written. A few minor edges have changed in bash in the
latest times, but you are unlikely to get touched by these unless you are
using some rare feature. After all, bash is compatible with the original
bourne shell to a big extent, and that part of its behavior never changes.

If you truly want to learn bash, I say go for it and come back when/if you
have some problem.

--
Jesús Guerrero
 
Old 12-22-2009, 10:16 AM
Stroller
 
Default Writing a bash script or thinking about it anyway.

On 22 Dec 2009, at 03:22, Dale wrote:
... I found a guide but before I read all that stuff and muddy up
the waters, is this thing current and will it work fine with the
bash Gentoo uses? Links to a even better guide would be good too.
The guide I found is here:


http://tldp.org/LDP/abs/html/


The Advanced Scripting Guide is brilliant. It's my gospel when Bash
scripting, although I'll admit I haven't looked harder for anything
else. If there is any better guide out there, I would love to hear
about it.


The examples given are just that - examples. I'm sure they're intended
for you to make changes in order to suit yourself, although you may
well find that some of them suit you just fine as is.


Stroller.
 
Old 12-22-2009, 10:20 AM
Christian Könitzer
 
Default Writing a bash script or thinking about it anyway.

I agree with Jesús but recommend you to use rsync for backup purpose.
Simple google for rsync backup script.
And this link explains why:
http://www.sanitarium.net/golug/rsync_backups.html

There are a lot backup scripts using rsync out there and most of them
are written in bash so it's anyway a good idea to learn a bit bash



Am 22.12.2009 11:34, schrieb Jesús Guerrero:

On Mon, 21 Dec 2009 21:22:05 -0600, Dale<rdalek1967@gmail.com> wrote:


Hi folks,

Me again. I'm thinking about writing a bash script that backs up my
/home directory. I found a guide but before I read all that stuff and
muddy up the waters, is this thing current and will it work fine with
the bash Gentoo uses? Links to a even better guide would be good too.
The guide I found is here:

http://tldp.org/LDP/abs/html/


The advanced bash scripting guide will be equally valid nowadays as it was
when it was first written. A few minor edges have changed in bash in the
latest times, but you are unlikely to get touched by these unless you are
using some rare feature. After all, bash is compatible with the original
bourne shell to a big extent, and that part of its behavior never changes.

If you truly want to learn bash, I say go for it and come back when/if you
have some problem.
 
Old 12-22-2009, 11:11 AM
Jesús Guerrero
 
Default Writing a bash script or thinking about it anyway.

On Tue, 22 Dec 2009 12:20:46 +0100, Christian Könitzer <chkab@gmx.ch>
wrote:
> I agree with Jesús but recommend you to use rsync for backup purpose.
> Simple google for rsync backup script.
> And this link explains why:
> http://www.sanitarium.net/golug/rsync_backups.html
>
> There are a lot backup scripts using rsync out there and most of them
> are written in bash so it's anyway a good idea to learn a bit bash

That's basically it. I also agree that rsync is nowadays the way to go for
general purpose backups, unless...

a) the volume can't be mounted while the backup is running (not the
case)
b) your fs supports snapshots (or you use LVM)
c) you have an rcs based solution, like svn, git or whatever else

The snapshot option is the absolute safest because it ensures that all the
files will be consistent, and the tar based solution is probably the worst
of them unless you truly can guarantee that the files are not being written
concurrently while you do the backup (i.e. the fs is not being used at all
or it's mounted read only). A good practice in any case is to capture the
exist status of any given tool you are going to use to ensure that no error
happened. Discovering that a backup is incomplete or corrupt when you need
it is a bit unpleasant to say the least.

Bash can be used for that, just to put a simple example. As you say,
regardless of the solution of your choice to do the actual backup there's a
lot of room for improvement, automation, error loging, verification, etc.
using shell scripting.


--
Jesús Guerrero
 

Thread Tools




All times are GMT. The time now is 10:42 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org