diff options
| author | Zdenek Prikryl <zprikryl@redhat.com> | 2009-05-13 12:32:53 +0200 |
|---|---|---|
| committer | Zdenek Prikryl <zprikryl@redhat.com> | 2009-05-13 12:32:53 +0200 |
| commit | 3fbc9c61f0d262b6958cefd1d1bdd1989d8a1285 (patch) | |
| tree | 126d73da333524fb748f6914a0f0e045990a0326 /src/Daemon | |
| parent | f50ecffe0f1853947c0a56cb89882cbdbf82265b (diff) | |
| download | abrt-3fbc9c61f0d262b6958cefd1d1bdd1989d8a1285.tar.gz abrt-3fbc9c61f0d262b6958cefd1d1bdd1989d8a1285.tar.xz abrt-3fbc9c61f0d262b6958cefd1d1bdd1989d8a1285.zip | |
new abrt's cron config style
Diffstat (limited to 'src/Daemon')
| -rw-r--r-- | src/Daemon/CrashWatcher.cpp | 34 | ||||
| -rw-r--r-- | src/Daemon/abrt.conf | 5 |
2 files changed, 25 insertions, 14 deletions
diff --git a/src/Daemon/CrashWatcher.cpp b/src/Daemon/CrashWatcher.cpp index f811501..ad497c9 100644 --- a/src/Daemon/CrashWatcher.cpp +++ b/src/Daemon/CrashWatcher.cpp @@ -198,28 +198,38 @@ void CCrashWatcher::SetUpCron() for (it_c = cron.begin(); it_c != cron.end(); it_c++) { std::string::size_type pos = it_c->first.find(":"); - std::string sH = it_c->first; - std::string sM = ""; + int timeout = 0; int nH = -1; int nM = -1; + int nS = -1; time_t actTime = time(NULL); if (pos != std::string::npos) { + std::string sH = ""; + std::string sM = ""; + sH = it_c->first.substr(0, pos); - sM = it_c->first.substr(pos + 1); - } - int timeout = 0; - if (sH != "*") - { nH = atoi(sH.c_str()); - timeout = nH * 60 * 60; + nH = nH > 23 ? 23 : nH; + nH = nH < 0 ? 0 : nH; + nM = nM > 59 ? 59 : nM; + nM = nM < 0 ? 0 : nM; + timeout += nH * 60 * 60; + sM = it_c->first.substr(pos + 1); + nM = atoi(sM.c_str()); + timeout += nM * 60; } - if (sM != "*") + else { - nM = atoi(sM.c_str()); - timeout = nM * 60; + std::string sS = ""; + + sS = it_c->first; + nS = atoi(sS.c_str()); + nS = nS < 0 ? 0 : nS; + timeout = nS; } - if (nH == -1 || nM == -1) + + if (nS != -1) { CSettings::vector_pair_strings_t::iterator it_ar; for (it_ar = it_c->second.begin(); it_ar != it_c->second.end(); it_ar++) diff --git a/src/Daemon/abrt.conf b/src/Daemon/abrt.conf index d059a9e..1739509 100644 --- a/src/Daemon/abrt.conf +++ b/src/Daemon/abrt.conf @@ -26,5 +26,6 @@ CCpp = Logger # repeated calling of Action plugins [ Cron ] -# hh,mm -*:1 = KerneloopsScanner +# h:m - at h:m an action plugin is activated +# s - every s seconds is an action plugin activated +10 = KerneloopsScanner |
