Linked by Eugenia Loli on Sun 10th Apr 2005 17:53 UTC
Linux This article describes an example bash shell script which demonstrates a simple method of creating backups of multiple filesystems to several tape drives simultaneously. The example script can easily be modified to write to other device types and to create a different number of backup streams.
Order by: Score:
meh.
by Mike on Sun 10th Apr 2005 18:11 UTC

I appreciate the attempt, but next time, leave the humor to the pros.

Rip off
by Anonymous on Sun 10th Apr 2005 18:29 UTC

This article was much better six years ago when it was written by Neal Stephenson

what?
by Anonymous on Sun 10th Apr 2005 18:30 UTC

uhh, i posted that comment on the OS/Car analogy story...

bash
by Geert Hendrickx on Sun 10th Apr 2005 21:12 UTC

Bah, why'd you need bash for this? Any Bourne-compatible shell can run this. Stick to POSIX /bin/sh for portable scripts.

v pooh
by Anonymous on Sun 10th Apr 2005 21:51 UTC
RE: bash
by Anonymous on Sun 10th Apr 2005 21:54 UTC

"Any Bourne-compatible shell can run this"

Yep, I just tried it -- it works fine under /bin/sh.

RE: RE: bash
by Roguelazer on Mon 11th Apr 2005 00:55 UTC

Seeing if something works with /bin/sh isn't really a good test of its portability...

$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Mar 30 17:26 /bin/sh -> bash

:P

Sense
by dennis on Mon 11th Apr 2005 05:45 UTC

I really don't see the sense to publish a script every UNIX sysadmin should be able to write in 1 minute. Even in Sh, Ksh, Csh or perl. :-)

Mhhmhh
by Sam on Mon 11th Apr 2005 08:17 UTC

Why use /bin/bash? This thing runs in every POSIX-compatible shell. Why hardcode paths of every program you run? Just make sure you have a sane PATH in your environment. Why use /bin/echo when every modern shell (read: written in the last 15 years) has it built in? Why do N wait's when you can do one? Yada-yada-ya :-P

agreed to most of the answers here
by tom on Mon 11th Apr 2005 12:17 UTC

I believe every junior Unix system admin has written something more sophisticated and portable...
and if the target doesnt consist of multiple independent drives, which are much slower than the source storage, doing parallel operation only increases overhead.

besides:
proxy:~# ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Apr 10 02:37 /bin/sh -> dash

this is way better on Linux.

Not that I really care
by Father Baker on Mon 11th Apr 2005 13:49 UTC

but i think this was more of a tutorial of "This is how it can be done - look at all of the very obvious and well commented code" rather than an attempt to show the most elegant code possible. Also, FWIW, even if /bin/sh isn't a link to /bin/bash, #!/bin/sh just grabs your default system shell these days - bash, tcsh, whatever - on most *nixes.

comment:
by tom on Mon 11th Apr 2005 13:51 UTC

> Just make sure you have a sane PATH in your environment.
I don't actually want my backup script to have a PATH, though it makes the stuff more portable, if u use thing's that are in /usr/.

But speaking for myself, the stuff in /bin is alright for a backup script, plus the shell-shuilt-ins.

tcsh as sh?
by tom on Mon 11th Apr 2005 13:58 UTC

> #!/bin/sh just grabs your default system shell these days - bash, tcsh, whatever - on most *nixes.

/bin/sh sometimes a link to tcsh? You know this would break... well ALOT, and nobody sane would do this.

...but hell that's what i thought about linking bash to /bin/sh before i noticed more and more Linux distros do that.

/me hates the so called sh compatibility mode in bash, because it's not and people tend to think it is, thus using sh features, that are infact bash features, all under the sign of:"#!/bin/sh" ;)

NO
by Bazfaz on Mon 11th Apr 2005 19:57 UTC

I can't imagine that's true. I know that if no default is mentioned, and the script is run as a user, the shell should refer to the shell listed in /etc/password, but linking sh to any c shell would be insanity.

Yeah
by Father Baker on Tue 12th Apr 2005 13:13 UTC

That's what I meant - somehow my confused idiot pre-coffee mind got things jumbled with sh compatibility. Sorry.

Vulnerabilities...
by Anonymous on Wed 13th Apr 2005 08:23 UTC

Remember, this script is really vulnerability to simply symlink attacks...

Typically backup script is runt by root. If attacker creates symlink /tmp/date.0 -> /etc/shadow (ln -s /etc/shadow /tmp/date.0), he (or she, whatever) can cause nice DoS.