[Box Backup-commit] COMMIT r2658 - box/RELEASE/0.11rc7/bin/bbackupd
subversion at boxbackup.org
subversion at boxbackup.org
Mon Mar 8 21:30:10 GMT 2010
Author: chris
Date: 2010-03-08 21:30:10 +0000 (Mon, 08 Mar 2010)
New Revision: 2658
Modified:
box/RELEASE/0.11rc7/bin/bbackupd/BackupDaemon.cpp
Log:
Merge part of [2597] from trunk into 0.11rc7. Revert the quotes part of
[2588] as it breaks the unit tests.
Modified: box/RELEASE/0.11rc7/bin/bbackupd/BackupDaemon.cpp
===================================================================
--- box/RELEASE/0.11rc7/bin/bbackupd/BackupDaemon.cpp 2010-03-08 21:28:01 UTC (rev 2657)
+++ box/RELEASE/0.11rc7/bin/bbackupd/BackupDaemon.cpp 2010-03-08 21:30:10 UTC (rev 2658)
@@ -1017,16 +1017,16 @@
// 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::string script("\"" + conf.GetKeyValue("SyncAllowScript") +
- "\" \"" + GetConfigFileName() + "\"");
+ std::auto_ptr<IOStream> pscript(LocalProcessStream(script,
+ pid));
- std::auto_ptr<IOStream> pscript(LocalProcessStream(
- script.c_str(), pid));
-
// Read in the result
IOStreamGetLine getLine(*pscript);
std::string line;
@@ -1048,15 +1048,14 @@
catch(ConversionException &e)
{
BOX_ERROR("Invalid output from "
- "SyncAllowScript " <<
- script << ": '" << line << "'");
+ "SyncAllowScript: '" <<
+ line << "' (" << script << ")");
throw;
}
BOX_NOTICE("Delaying sync by " << waitInSeconds
- << " seconds (SyncAllowScript "
- << conf.GetKeyValue("SyncAllowScript")
- << ")");
+ << " seconds due to SyncAllowScript "
+ << "(" << script << ")");
}
}
@@ -1064,14 +1063,14 @@
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
@@ -2188,19 +2187,19 @@
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") + "\" " +
+ 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());
More information about the Boxbackup-commit
mailing list