Bash script clobbers something vital (lucid)

Kevin O'Gorman kogorman at gmail.com
Sat Nov 19 22:21:46 UTC 2011


On Fri, Nov 18, 2011 at 10:18 PM, Karl Auer <kauer at biplane.com.au> wrote:
> On Fri, 2011-11-18 at 22:10 -0800, Kevin O'Gorman wrote:
>> I've been tweaking a backup script.
>
> Post the script.

Attached. It's in three parts, all of them living in /root/scripts
  ball.sh -- this is what I use on the command-line to back up
everything on the local machine.   The problem happens in the middle
of this script.  The version attached has been modified slightly --
the  'bkdf' call used to be after bksumit, but that caused the output
of 'df' to be excluded from the md5sums.

  bkfuncts.sh -- a file to be sourced.  It creates some variables and
defines some functions.

  bkdropkick.sh -- a script to be sourced.  It defines the backup
tasks for the host "dropkick".  I have other versions for other hosts.

NOTE that the scripts check mount points but do not mount or unmount
anything.  Moreover, all of the commands invoked are plain vanilla
administrative commands.  I have not coded anything in C, nor used any
non- utilities.  It's pretty much done with dd, df, blkid, tar,
ntfsclone, gzip and md5sum.
NOTE: you can do what you like with these scripts, but be aware they
make provoke weird behavior on your system.  They do for me.

>> The shell logic seems okay.  If I reboot the system and fsck the
>> backup drive, all seems working.  If I comment out all of the commands
>> that worked, running the shell starts computing the md5sum's okay.
>
> Are you saying that the drive is dead until you reboot, then the drive
> becomes mountable again and no data has been lost?

Yes, except that I have not actually verified that the data is okay.
The backup is ext4, and fsck says it replayed the journal okay, and
has no other remarks to make.

> Regards, K.
>


-- 
Kevin O'Gorman, PhD
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ball.sh
Type: application/x-sh
Size: 514 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20111119/96e995e1/attachment.sh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bkfuncts.sh
Type: application/x-sh
Size: 5299 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20111119/96e995e1/attachment-0001.sh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bkdropkick.sh
Type: application/x-sh
Size: 402 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20111119/96e995e1/attachment-0002.sh>


More information about the ubuntu-users mailing list