17 int read_args(int argc, char *argv[], struct user_options *opts)
19 int option_index = 0, c;
20 static struct option long_options[] = {
21 { .val = 'j', .name = "jobs", .has_arg = 1, },
24 char short_options[] = "j:";
27 c = getopt_long(argc, argv, short_options, long_options,
35 opts->max_jobs = atoi(optarg);
45 int main(int argc, char *argv[])
47 struct user_options opts;
48 struct rrd_database *db, **db_list = NULL;
51 bzero(&opts, sizeof(opts));
53 if (read_args(argc, argv, &opts) < 0)
56 if (rrdtool_create_missing_databases(db_list))
59 if (init_jobcontrol(opts.max_jobs))
63 pr_info("loop start\n");
65 * Update all databases parallel in one shot
67 while ((db = get_outdated_db(db_list)))
68 rrdtool_update_data(db);
70 sleeptime = get_next_update(db_list);
72 pr_info("Time to sleep %d seconds\n", sleeptime);
73 poll_job_requests(sleeptime);