Stephen, On Sep 20, 2007, at 8:18 PM, Stephen Joyce wrote:
> Use 'mount' instead of checking for directory existence to > determine if the filesystem is mounted and return the corresponding > exit status? (if backuppc has created the directory structure on > the main drive instead of a mounted one, it's safe to remove inside > the script. Use 'rm' on each level working your way up, NOT 'rm - > rf' on the parent, if you're paranoid or don't fully trust your > script.) > > Or am I misunderstanding the problem? > Hey, that's a good idea. You certainly did not misunderstand the problem, and I believe that will work. I do wish that there was a way to prevent backuppc from even creating the filesystem in the first place, but having a script clean it up is ok. I would get nervous that it would somehow delete my whole backup tree though - is there a way using a simple shell script to determine the size of the contents of a directory? Certainly my backups would be larger than 1 MB, and the default file structure for backuppc is quite small, so I could just not delete anything if the directory contains > 1 MB of data, and somehow alert myself about the problem. Thoughts? Thanks! -- Kimball > Cheers, Stephen > -- > Stephen Joyce > Systems Administrator P > A N I C > Physics & Astronomy Department Physics & > Astronomy > University of North Carolina at Chapel Hill Network > Infrastructure > voice: (919) 962-7214 and > Computing > fax: (919) 962-0480 http:// > www.panic.unc.edu > > Some people make the world turn and others just watch it spin. > -- Jimmy Buffet > > On Thu, 20 Sep 2007, Kimball Larsen wrote: > >> Ok, I've done a bunch more research into this, and discovered the >> problem: >> >> backuppc creates the target directories for the backup destination >> BEFORE it calls BackupPC_dump, so my pre conditions are always >> returning true, because BackupPC just created the necessary file >> structure. >> >> So, I'm looking for either a) where is the check that decides to >> create the file structure before doing a dump or b) how to re- >> arrange my setup so that backupPC just fails if the destination >> for the backup does not exist. >> >> Again, here's my setup: >> >> /Volumes/Honker <-- this is an external hard drive that is only >> mounted periodically. When it is not mounted, /Volumes does NOT >> have a "Honker" directory. >> >> >> here's with my external drive disconnected: >> MainEngineering:/Volumes root# pwd >> /Volumes >> MainEngineering:/Volumes root# ls -la >> total 8 >> drwxrwxrwt 3 root admin 102 Sep 20 14:57 . >> drwxr-xr-x 31 root wheel 1156 Sep 18 12:21 .. >> lrwxr-xr-x 1 root admin 1 Sep 18 12:21 Guido -> / >> MainEngineering:/Volumes root# >> >> >> and again with it connected: >> MainEngineering:/Volumes root# ls -la >> total 8 >> drwxrwxrwt 4 root admin 136 Sep 20 14:58 . >> drwxr-xr-x 31 root wheel 1156 Sep 18 12:21 .. >> lrwxr-xr-x 1 root admin 1 Sep 18 12:21 Guido -> / >> drwxr-xr-x 8 unknown unknown 374 Sep 20 14:45 Honker >> MainEngineering:/Volumes root# >> >> >> The problem is that if a Honker directory exists in /Volumes, then >> when I attach the drive, it mounts as Honker-1, so my backups >> don't get to the right file system. >> >> Help! >> >> -- Kimball >> On Sep 20, 2007, at 1:24 PM, Kimball Larsen wrote: >> >>> (Sorry for the re-post - I realized I forgot to put on a subject >>> last time) >>> Hokay, I'm stuck. I give. I need help. >>> The documentation for UserCmdCheckStatus says: >>> >>> "Whether the exit status of each PreUserCmd and PostUserCmd is >>> checked. >>> >>> "If set and the Dump/Restore/Archive Pre/Post UserCmd returns >>> a non-zero exit status then the dump/restore/archive is aborted. >>> To maintain backward compatibility (where the exit status in >>> early versions was always ignored), this flag defaults to 0. >>> >>> "If this flag is set and the Dump/Restore/Archive PreUserCmd >>> fails then the matching Dump/Restore/Archive PostUserCmd is not >>> executed. If DumpPreShareCmd returns a non-exit status, then >>> DumpPostShareCmd is not executed, but the DumpPostUserCmd is >>> still run (since DumpPreUserCmd must have previously succeeded). >>> >>> "An example of a DumpPreUserCmd that might fail is a script >>> that snapshots or dumps a database which fails because of some >>> database error." >>> Simple enough - so I wrote a script to verify that the location >>> to which I am about to try to backup actually exists (I'm backing >>> up to a removable drive that does get removed, from time to time, >>> and I only want the backups to run when the drive is attached). >>> Then I set this script to the value for the various Pre conditions: >>> $Conf{DumpPreUserCmd} = '$sshPath -q -x -l kimball $host /usr/ >>> local/bin/checkHonker'; >>> $Conf{DumpPostUserCmd} = undef; >>> $Conf{DumpPreShareCmd} = '$sshPath -q -x -l kimball $host /usr/ >>> local/bin/checkHonker'; >>> $Conf{DumpPostShareCmd} = undef; >>> $Conf{RestorePreUserCmd} = '$sshPath -q -x -l kimball $host /usr/ >>> local/bin/checkHonker'; >>> $Conf{RestorePostUserCmd} = undef; >>> $Conf{ArchivePreUserCmd} = '$sshPath -q -x -l kimball $host /usr/ >>> local/bin/checkHonker'; >>> $Conf{ArchivePostUserCmd} = undef; >>> and I set it to check the status of the user commands: >>> $Conf{UserCmdCheckStatus} = 1; >>> But it still runs the backup (and writes over my mount point for >>> my external drive) >>> I've verified that the script returns a non-zero when the drive >>> is not present: >>> sillyHost:~ backuppc$ /usr/bin/ssh -q -x -l kimball 192.168.0.21 / >>> usr/local/bin/checkHonker >>> Checking for Honker >>> Honker NOT mounted >>> sillyHost:~ backuppc $ echo $? >>> 1 >>> What am I missing? >>> -- Kimball >>> -------------------------------------------------------------------- >>> ----- >>> This SF.net email is sponsored by: Microsoft >>> Defy all challenges. Microsoft(R) Visual Studio 2005. >>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >>> _______________________________________________ >>> BackupPC-users mailing list >>> BackupPC-users@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/backuppc-users >>> http://backuppc.sourceforge.net/ >> >> >> >> -- >> ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ BackupPC-users mailing list BackupPC-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/backuppc-users http://backuppc.sourceforge.net/