[Box Backup-commit] COMMIT r2588 - box/trunk/bin/bbackupd
subversion at boxbackup.org
subversion
Thu Nov 26 21:44:23 GMT 2009
Author: chris
Date: 2009-11-26 21:44:22 +0000 (Thu, 26 Nov 2009)
New Revision: 2588
Modified:
box/trunk/bin/bbackupd/BackupDaemon.cpp
Log:
Add location of config file as an additional parameter to the
SyncAllowScript and the NotifyScript, thanks to Achim J. Latz.
Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp
===================================================================
--- box/trunk/bin/bbackupd/BackupDaemon.cpp 2009-11-24 22:32:13 UTC (rev 2587)
+++ box/trunk/bin/bbackupd/BackupDaemon.cpp 2009-11-26 21:44:22 UTC (rev 2588)
@@ -1021,8 +1021,11 @@
pid_t pid = 0;
try
{
+ std::string script("\"" + conf.GetKeyValue("SyncAllowScript") +
+ "\" \"" + GetConfigFileName() + "\"");
+
std::auto_ptr<IOStream> pscript(LocalProcessStream(
- conf.GetKeyValue("SyncAllowScript").c_str(), pid));
+ script.c_str(), pid));
// Read in the result
IOStreamGetLine getLine(*pscript);
@@ -1044,17 +1047,16 @@
}
catch(ConversionException &e)
{
- BOX_ERROR("Invalid output "
- "from SyncAllowScript '"
- << conf.GetKeyValue("SyncAllowScript")
- << "': '" << line << "'");
+ BOX_ERROR("Invalid output from "
+ "SyncAllowScript " <<
+ script << ": '" << line << "'");
throw;
}
BOX_NOTICE("Delaying sync by " << waitInSeconds
- << " seconds (SyncAllowScript '"
+ << " seconds (SyncAllowScript "
<< conf.GetKeyValue("SyncAllowScript")
- << "')");
+ << ")");
}
}
@@ -2193,20 +2195,19 @@
}
// 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)
More information about the Boxbackup-commit
mailing list