]> git.itanic.dy.fi Git - rrdd/commitdiff
Merge branch 'master' of /home/git/rrdd
authorTimo Kokkonen <timo.t.kokkonen@iki.fi>
Sat, 9 Jul 2016 07:05:36 +0000 (10:05 +0300)
committerTimo Kokkonen <timo.t.kokkonen@iki.fi>
Sat, 9 Jul 2016 07:05:36 +0000 (10:05 +0300)
Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
config.c
process.c
rrdtool.c
rrdtool.h

index 68939bdc499edded4a32346ecfd1356f70f6c513..8ac1b63a867fad23e727938afad3fdcdf9792ebc 100644 (file)
--- a/config.c
+++ b/config.c
@@ -232,6 +232,7 @@ static int parse_database(config_setting_t *rrd, struct rrd_database *db)
        config_setting_t *list, *str_list;
        const char *name, *parser = NULL, *filename, **parser_data;
        const char **pre_draw_cmd;
+       const char **post_draw_cmd;
        const char *logfile = NULL, *logfile_timestamp_fmt = NULL;
 
        if (!config_setting_lookup_string(rrd, "name", &name)) {
@@ -274,6 +275,12 @@ static int parse_database(config_setting_t *rrd, struct rrd_database *db)
                db->pre_draw_cmd = (char *const *)pre_draw_cmd;
        }
 
+       str_list = config_setting_get_member(rrd, "post_draw_cmd");
+       if (str_list) {
+               read_strings_from_list(str_list, &post_draw_cmd);
+               db->pre_draw_cmd = (char *const *)post_draw_cmd;
+       }
+
        config_setting_lookup_string(rrd, "logfile", &logfile);
        if (logfile)
                db->logfile = strdup(logfile);
index b4319fe869aa92188c90762e987670c8362419ba..ae13277269dd4f68016fe7995a859bbd166ff70f 100644 (file)
--- a/process.c
+++ b/process.c
@@ -814,7 +814,7 @@ print:
                                else
                                        pr_info("%s: stdout: %s\n",
                                                cmd, sptr);
-                               sptr = eptr;
+                               sptr = eptr + 1;
                        }
                        eptr++;
                }
index be6232177f909d8217e1f0fef8509b764f80b68b..c8754176fd66ac6855422356914103e7af6b1b47 100644 (file)
--- a/rrdtool.c
+++ b/rrdtool.c
@@ -287,6 +287,9 @@ static int do_rrdtool_update_data(struct rrd_database *rrd)
        if (rrd->images)
                rrdtool_draw_images(rrd->images);
 
+       if (rrd->post_draw_cmd && !strcmp(rrd->post_draw_cmd[0], "shell"))
+               run(rrd->post_draw_cmd[1], &rrd->post_draw_cmd[1]);
+
        return 0;
 }
 
index 91fab9cfada4246e7f155a1aa7af12b949ff5add..ec8a9d432dd5b53d3a23d911dff9535bda83981f 100644 (file)
--- a/rrdtool.h
+++ b/rrdtool.h
@@ -41,6 +41,7 @@ struct rrd_database {
        const char **parser_data;       /* data to be fed to the parser */
 
        char *const *pre_draw_cmd; /* Command to execute prior drawing images*/
+       char *const *post_draw_cmd; /* ..and after drawing images */
 
        struct  rrd_image **images; /* Images to draw */