diff options
Diffstat (limited to 'bin/bbackupd')
-rw-r--r-- | bin/bbackupd/BackupClientDirectoryRecord.cpp | 30 | ||||
-rw-r--r-- | bin/bbackupd/BackupDaemon.cpp | 36 | ||||
-rw-r--r-- | bin/bbackupd/BackupDaemon.h | 10 | ||||
-rw-r--r-- | bin/bbackupd/BackupDaemonInterface.h | 3 | ||||
-rw-r--r-- | bin/bbackupd/Makefile.extra | 2 |
5 files changed, 53 insertions, 28 deletions
diff --git a/bin/bbackupd/BackupClientDirectoryRecord.cpp b/bin/bbackupd/BackupClientDirectoryRecord.cpp index b8d42d47..e03d53c2 100644 --- a/bin/bbackupd/BackupClientDirectoryRecord.cpp +++ b/bin/bbackupd/BackupClientDirectoryRecord.cpp @@ -294,14 +294,21 @@ void BackupClientDirectoryRecord::SyncDirectory( #else if(EMU_LSTAT(filename.c_str(), &file_st) != 0) { - // Report the error (logs and - // eventual email to administrator) - rNotifier.NotifyFileStatFailed(this, - filename, strerror(errno)); + if(!(rParams.mrContext.ExcludeDir( + filename))) + { + // Report the error (logs and + // eventual email to + // administrator) + rNotifier.NotifyFileStatFailed( + this, filename, + strerror(errno)); - // FIXME move to NotifyFileStatFailed() - SetErrorWhenReadingFilesystemObject( - rParams, filename.c_str()); + // FIXME move to + // NotifyFileStatFailed() + SetErrorWhenReadingFilesystemObject( + rParams, filename.c_str()); + } // Ignore this entry for now. continue; @@ -606,8 +613,10 @@ void BackupClientDirectoryRecord::UpdateAttributes(BackupClientDirectoryRecord:: const StreamableMemBlock &storeAttrEnc(pDirOnStore->GetAttributes()); // Explict decryption BackupClientFileAttributes storeAttr(storeAttrEnc); + // Compare the attributes - if(attr.Compare(storeAttr, true, true /* ignore both modification times */)) + if(attr.Compare(storeAttr, true, + true /* ignore both modification times */)) { // No update necessary updateAttr = false; @@ -918,7 +927,7 @@ bool BackupClientDirectoryRecord::UpdateItems( BOX_TRACE("Upload decision: " << filename << ": will not upload " "(modified too recently: " - "only " << age << "seconds ago)"); + "only " << age << " seconds ago)"); } else { @@ -1041,6 +1050,9 @@ bool BackupClientDirectoryRecord::UpdateItems( { try { + rNotifier.NotifyFileUploadingAttributes( + this, filename); + // Update store BackupClientFileAttributes attr; attr.ReadAttributes(filename.c_str(), false /* put mod times in the attributes, please */); diff --git a/bin/bbackupd/BackupDaemon.cpp b/bin/bbackupd/BackupDaemon.cpp index 3615b848..5134d234 100644 --- a/bin/bbackupd/BackupDaemon.cpp +++ b/bin/bbackupd/BackupDaemon.cpp @@ -1017,12 +1017,15 @@ int BackupDaemon::UseScriptToSeeIfSyncAllowed() // If there's no result, try again in five minutes int waitInSeconds = (60*5); + std::string script(conf.GetKeyValue("SyncAllowScript") + + " \"" + GetConfigFileName() + "\""); + // Run it? pid_t pid = 0; try { - std::auto_ptr<IOStream> pscript(LocalProcessStream( - conf.GetKeyValue("SyncAllowScript").c_str(), pid)); + std::auto_ptr<IOStream> pscript(LocalProcessStream(script, + pid)); // Read in the result IOStreamGetLine getLine(*pscript); @@ -1044,17 +1047,15 @@ int BackupDaemon::UseScriptToSeeIfSyncAllowed() } catch(ConversionException &e) { - BOX_ERROR("Invalid output " - "from SyncAllowScript '" - << conf.GetKeyValue("SyncAllowScript") - << "': '" << line << "'"); + BOX_ERROR("Invalid output from " + "SyncAllowScript: '" << + line << "' (" << script << ")"); throw; } BOX_NOTICE("Delaying sync by " << waitInSeconds - << " seconds (SyncAllowScript '" - << conf.GetKeyValue("SyncAllowScript") - << "')"); + << " seconds due to SyncAllowScript " + << "(" << script << ")"); } } @@ -1062,14 +1063,14 @@ int BackupDaemon::UseScriptToSeeIfSyncAllowed() catch(std::exception &e) { BOX_ERROR("Internal error running SyncAllowScript: " - << e.what()); + << e.what() << " (" << script << ")"); } catch(...) { // Ignore any exceptions // Log that something bad happened - BOX_ERROR("Error running SyncAllowScript '" - << conf.GetKeyValue("SyncAllowScript") << "'"); + BOX_ERROR("Unknown error running SyncAllowScript (" << + script << ")"); } // Wait and then cleanup child process, if any @@ -2186,27 +2187,26 @@ void BackupDaemon::NotifySysadmin(SysadminNotifier::EventCode Event) Event != SysadminNotifier::BackupFinish) { BOX_INFO("Not notifying administrator about event " - << sEventNames[Event] << " -- set NotifyScript " + << sEventNames[Event] << ", set NotifyScript " "to do this in future"); } return; } // Script to run - std::string script(conf.GetKeyValue("NotifyScript") + ' ' + - sEventNames[Event]); + std::string script(conf.GetKeyValue("NotifyScript") + " " + + sEventNames[Event] + " \"" + GetConfigFileName() + "\""); // Log what we're about to do BOX_INFO("About to notify administrator about event " - << sEventNames[Event] << ", running script '" - << script << "'"); + << sEventNames[Event] << ", running script '" << script << "'"); // Then do it int returnCode = ::system(script.c_str()); if(returnCode != 0) { BOX_WARNING("Notify script returned error code: " << - returnCode << " ('" << script << "')"); + returnCode << " (" << script << ")"); } else if(Event != SysadminNotifier::BackupStart && Event != SysadminNotifier::BackupFinish) diff --git a/bin/bbackupd/BackupDaemon.h b/bin/bbackupd/BackupDaemon.h index 0c864abd..b41c6508 100644 --- a/bin/bbackupd/BackupDaemon.h +++ b/bin/bbackupd/BackupDaemon.h @@ -444,6 +444,16 @@ public: BOX_NOTICE("Uploading patch to file: " << rLocalPath); } } + virtual void NotifyFileUploadingAttributes( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) + { + if (mLogAllFileAccess) + { + BOX_NOTICE("Uploading new file attributes: " << + rLocalPath); + } + } virtual void NotifyFileUploaded( const BackupClientDirectoryRecord* pDirRecord, const std::string& rLocalPath, diff --git a/bin/bbackupd/BackupDaemonInterface.h b/bin/bbackupd/BackupDaemonInterface.h index 5bbdd427..2a2d8d4b 100644 --- a/bin/bbackupd/BackupDaemonInterface.h +++ b/bin/bbackupd/BackupDaemonInterface.h @@ -123,6 +123,9 @@ class ProgressNotifier virtual void NotifyFileUploadingPatch( const BackupClientDirectoryRecord* pDirRecord, const std::string& rLocalPath) = 0; + virtual void NotifyFileUploadingAttributes( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) = 0; virtual void NotifyFileUploaded( const BackupClientDirectoryRecord* pDirRecord, const std::string& rLocalPath, diff --git a/bin/bbackupd/Makefile.extra b/bin/bbackupd/Makefile.extra index 52e21366..25ceb1e7 100644 --- a/bin/bbackupd/Makefile.extra +++ b/bin/bbackupd/Makefile.extra @@ -3,5 +3,5 @@ MAKEEXCEPTION = ../../lib/common/makeexception.pl # AUTOGEN SEEDING autogen_ClientException.h autogen_ClientException.cpp: $(MAKEEXCEPTION) ClientException.txt - $(PERL) $(MAKEEXCEPTION) ClientException.txt + $(_PERL) $(MAKEEXCEPTION) ClientException.txt |