[Dirvish] Run post script depending on success/failure?
dhoworth at mrc-lmb.cam.ac.uk
Thu Dec 22 11:08:17 UTC 2005
On Thu, 2005-12-22 at 01:42 -0600, Chris Dunning wrote:
> It's nearly 2 AM and I haven't had much coffee, forgive me if I'm
> I'm using Dirvish to back up several machines, some of which are not
> always accessible at backup time because they are either roaming laptops
> or were powered off when the cron script ran. My personal laptop, for
> example, has been in the shop for nearly three weeks to replace a blown
> motherboard. When I've gone back into the backups to find old files,
> I've come across lots of directories with nothing but a log since the
> backup did not successfully complete. I'd like to do one of two things
> with these directories:
> Ideally, delete them. I realize that the presence of the directory
> tells me that dirvish did run and attempted to backup that particular
> machine. However, the email that I receive when the cron finishes tells
> me the same thing. I don't think this is particularly necessary.
> If that's not possible (or inadvisable for some reason), have a symlink
> to the most recent backup that successfully completed (ie,
> /vault/branch/current). I could use a post-script for this, but I don't
> see a way in the docs to run a post-script only on success.
> As a hack I suppose I could run a cleanup script on a cron that would go
> through the directories and delete anything without a "tree"
> subdirectory...but that really seems like a hack.
> Any advice?
A while ago, I posted a script that I use to deal with a similar (but
not identical) requirement. Perhaps it will help you:
More information about the Dirvish