-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Here's the script I threw together:

- --
#!/bin/bash

BKUP_HOME=/mnt/backup/home
BKUP_MUSIC=/mnt/backup/music

EXPIRE=/usr/sbin/dirvish-expire
EXP_OPTS="--quiet"
RUNALL=/usr/sbin/dirvish-runall
RUN_OPTS="--quiet"


E_MNT_ALREADY_MOUNTED=32
E_UMNT_NOT_MOUNTED=1

MNT=/bin/mount
UMNT=/bin/umount

# Mount the backup filesystems
if [[ $($MNT $BKUP_HOME) -ne 0 ]]; then
  if [ "$?" -ne "$E_MNT_ALREADY_MOUNTED" ]; then
    echo "Failed to mount $BKUP_HOME!" 1>&2
    exit $?
  fi
fi

if [[ $($MNT $BKUP_MUSIC) -ne 0 ]]; then
  if [ "$?" -ne "$E_MNT_ALREADY_MOUNTED" ]; then
    echo "Failed to mount $BKUP_MUSIC!" 1>&2
    exit $?
  fi
fi

# Run dirvish-expire
if [[ $($EXPIRE $EXP_OPTS) -ne 0 ]]; then
  echo "$EXPIRE run failure!" 1>&2
  exit $?
fi

# Run dirvish-runall
if [[ $($RUNALL $RUN_OPTS) -ne 0 ]]; then
  echo "$RUNALL run failure!" 1>&2
  exit $?
fi

# Unmount the backup filesystems
if [[ $($UMNT $BKUP_HOME) -ne 0 ]]; then
  if [ "$?" -ne "$E_UMNT_NOT_MOUNTED" ]; then
    echo "Failed to unmount $BKUP_HOME!" 1>&2
    exit $?
  fi
fi
if [[ $($UMNT $BKUP_MUSIC) -ne 0 ]]; then
  if [ "$?" -ne "$E_UMNT_NOT_MOUNTED" ]; then
    echo "Failed to unmount $BKUP_MUSIC!" 1>&2
    exit $?
  fi
fi
- --

I could probably fold a lot that into functions, but this works for me
for now.  Is there anything I'm not doing which you think I could (or
should) be doing?  I've got the above script set up as a daily cronjob.


Keith Lofstrom wrote:
> On Sun, Sep 10, 2006 at 04:22:48PM -0500, Trey Blancher wrote:
> 
>> Ideally, I would like my setup so that my backup partitions only get
>> mounted when I'm about to backup.  So, I tried to  use pre-server to
>> mount my partitions before I created the initial image. My master.conf:
> 
> An excellent idea.  I do this by calling a shell script, dirvish-daily,
> which does setup, then calls dirvish-runall, then does shutdown.  In that
> script, I do other things, like keeping track of which vaults actually
> complete successfully, and adding a single daily status line to a backup
> log file. 
> 
> Dirvish looks for the additional configuration information in the vault
> config scripts, so they must be mounted first.  Hence the wrapper script;
> you can't do this with just the pre- and post- scripts.  I do use those
> for keeping track of failures, and initializing remote machines, etc.
> 
> In addition, I get a little wilder than just mount/unmount - before
> mounting the backup partition on /dev/hdXXX, I do a :
>    /sbin/hdparm -zb 1 /dev/hdXXX
> 
> After backups and unmount, I do a:
>    /sbin/hdparm -b 0 /dev/hdXXX
> 
> With the drive disconnected from the bus, and tristated, There is one
> more barrier to bad things happening.  However, this may not work for
> some 2.6 kernels.
> 
> If we can get the 1.3.x version moving, it will make a good platform
> for folding some of these behaviors into dirvish itself.
> 
> Keith
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQEVAwUBRQTSzZ76rTZSI4F7AQKhvgf+JmDwMNb5/iQPkJIuYKSV65hKaiQ1cIFw
7RQLxeikojxrLjVetBI7Zftt4H+SFnTM3Y8aUvsWvVk5r8xWJyZNI2jzKZrfdExe
LamBS1L0BGwIIWbyGhF9NFQ1l8I44+SfNJXhAyyQGckVmC2Bg5kR7z/uL59vmu1k
zQn9JTg7Fu3D+jxN+/wNCfZ9a7lL0lnVSX2hzPl7aq0oufA7MGRhLO4Q65X33V9X
2duONRqz/CSvby5UWt8bwkkWu3OpY3QlY7W7iZ5VoXnG/U1LyQjK6c21x/yCKjNb
wny4z5XUNeoM2ha40USosbgI+GHkqdgg3S6hNjf1vseTxT905wDoPg==
=RJdV
-----END PGP SIGNATURE-----
_______________________________________________
Dirvish mailing list
[email protected]
http://www.dirvish.org/mailman/listinfo/dirvish

Reply via email to