]> git.itanic.dy.fi Git - rrdd/blob - main.c
Collect all rrdtool handling in one file
[rrdd] / main.c
1 #include <sys/types.h>
2 #include <unistd.h>
3
4 #include "process.h"
5 #include "rrdtool.h"
6 #include "parser.h"
7 #include "scheduler.h"
8 #include "debug.h"
9
10 #include "database.h"
11
12
13 int main(int argc, char *argv[])
14 {
15         struct rrd_database *db;
16         int sleeptime;
17
18         while (1) {
19                 pr_info("loop start\n");
20                 /*
21                  * Update all databases parallel in one shot
22                  */
23                 while ((db = check_update_need((struct rrd_database **)
24                                                &all_rrds)))
25                         rrdtool_update_data(db);
26
27                 /*
28                  * Let the updates finish
29                  */
30                 if (harvest_zombies(0))
31                         continue;
32
33                 sleeptime = get_next_update((struct rrd_database **)&all_rrds);
34                 pr_info("Time to sleep %d seconds\n", sleeptime);
35                 sleep(sleeptime);
36
37         }
38         return 0;
39 }