From: Joe Z. <jz...@co...> - 2005-01-17 06:40:24
|
Joe Zacky wrote: > Jochen Metzger wrote: > >> Hi Rene, >> Hi Joe, >> >> i am inplementing for a customer and I thinking about logging stuff what >> we talked about a couple of months ago. >> >> Mainly I want: >> >> 1. Have logging what has be updated and what failed. >> 2. Be sure that bobs is still running properly >> >> as I work with companies and then let things running >> and maybe get notified when something went wrong. >> >> I have a couple of hours of budget to do some stuff >> and I want to discuss it with you first to then put >> it in the cvs afterwards. >> >> At present I wrote a workaround (quite a quickhack) >> that writes a timestamp and checks that. >> (I have to figure out, how I did that and if it makes >> sense to the main version) >> >> Any ideas ? >> Jochen Metzger >> >> >> > It's helpful, but I was thinking of adding real error checking to the > backup scripts to say things like "successful backup of > <server/share>" or "backup failed for <server/share>", with optional > email notification. But I won't be getting to it anytime soon. > > Joe Circumstances have forced me to get to it soon. One of the file servers where I work hadn't been getting fully backed up since November and I didn't know about it until I was asked to restore a file. So I spent a couple days last week working on error checking and logging in bobs. Here's the short synopsis, I'll explain more in detail when I'm ready to check into cvs. I put all the commands for the various backups into bash script templates (rFastTemplates) that are created by class_backup.php. Some of the code from class_backup.php was moved to the templates. The templates include return code checking on all the commands (mount, rsync, umount, etc.) and a function to send an optional completion status email, i.e. "BACKUP FAILED for server/share with returncode xx" or "Successful backup of server/share". The "BACKUP FAILED..." and "Successful backup..." are also logged into bobs.log. If you don't want the optional email for each backup, you could still 'grep' the completion messages from the log. The templates make the code much cleaner and will allow easy customization of backups. For example, you can remove the '--verbose' from the rsync, if you want to. I'm planning to include a customized template directory that you can copy the template to and change it there. If a customized template exists, it will be used instead of the standard template. That will allow you to keep your customizations when re-installing or upgrading bobs. It's been working very well the past week. I get a short email after each backup, if it failed I take a look at bobs.log to see why. I've done the smb and rsync-ssh templates, still need to do the others. I'm also looking into some other errors I see in bobs.log, mostly having to do with stat() and is_dir() on very large files failing while building the indexes after the backup has run. It seems it's a libc or glibc problem, but I need to handle the failure properly in the script. This should at least address the first item you mentioned: to log what has been updated and what failed. I'm hoping to put what I've done so far into cvs this week. Not sure when I'll get to finish it, but I hope soon, I think it's an important improvement. |