[rrd-developers] [PATCH 1/2] enable 'rrdtool flush' to handle more than one file name
kevin brintnall
kbrint at rufus.net
Fri Mar 6 20:10:22 CET 2009
---
doc/rrdflush.pod | 14 ++++++++------
src/rrd_flush.c | 12 +++++++++---
2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/doc/rrdflush.pod b/doc/rrdflush.pod
index 514bd35..5dbc60a 100644
--- a/doc/rrdflush.pod
+++ b/doc/rrdflush.pod
@@ -4,21 +4,23 @@ rrdflush - Flush the values for a spcific RRD file from memory.
=head1 SYNOPSIS
-B<rrdtool> B<flush> I<filename>
+B<rrdtool> B<flush>
S<[B<--daemon> I<address>]>
+I<filename> [I<filename> ...]
=head1 DESCRIPTION
-The B<flush> function connects to L<rrdcached>, the RRD caching daemon, and
-issues a "flush" command for the given file. The daemon will put this file to
-the head of the update queue so it is written "soon". The status will be
-returned only after the file's pending updates have been written to disk.
+The B<flush> function connects to L<rrdcached>, the RRD caching daemon,
+and issues a "flush" command for the given files. The daemon will put the
+files to the head of the update queue so they are written "soon". The
+status will be returned only after the files' pending updates have been
+written to disk.
=over 8
=item I<filename>
-The name of the B<RRD> that is to be written to disk.
+The name(s) of the B<RRD> file(s) that are to be written to disk.
=item B<--daemon> I<address>
diff --git a/src/rrd_flush.c b/src/rrd_flush.c
index 218a65a..2d8df3a 100644
--- a/src/rrd_flush.c
+++ b/src/rrd_flush.c
@@ -26,6 +26,7 @@ int rrd_cmd_flush (int argc, char **argv)
{
char *opt_daemon = NULL;
int status;
+ int i;
/* initialize getopt */
optind = 0;
@@ -65,9 +66,9 @@ int rrd_cmd_flush (int argc, char **argv)
}
} /* while (42) */
- if ((argc - optind) != 1)
+ if ((argc - optind) < 1)
{
- rrd_set_error ("Usage: rrdtool %s [--daemon <addr>] <file>", argv[0]);
+ rrd_set_error ("Usage: rrdtool %s [--daemon <addr>] <file> [<file> ...]", argv[0]);
return (-1);
}
@@ -85,7 +86,12 @@ int rrd_cmd_flush (int argc, char **argv)
return (-1);
}
- status = rrdc_flush(argv[optind]);
+ status = 0;
+ for (int i = optind; i < argc; i++)
+ {
+ status = rrdc_flush(argv[i]);
+ if (status) break;
+ }
return ((status == 0) ? 0 : -1);
} /* int rrd_flush */
--
1.6.1.3
More information about the rrd-developers
mailing list