diff --git a/stripchart/samples/db_count b/stripchart/samples/db_count index b80402f93e..1707b2a2f2 100755 --- a/stripchart/samples/db_count +++ b/stripchart/samples/db_count @@ -1,8 +1,9 @@ #! /bin/csh -# NOTE: this must be macro-substituted (for BOINC_DB_NAME) set CIVDATE = `date "+%Y:%m:%d:%H:%M"` set UNIXDATE = `perl -e 'print time()'` -set COUNT = `echo "use david_test; select count(*) from $1" | mysql | tail -1` +set DBNAME = `./parse_config db_name` + +set COUNT = `echo "use $DBNAME; select count(*) from $1" | mysql | tail -1` echo $CIVDATE $UNIXDATE $COUNT diff --git a/stripchart/samples/db_query b/stripchart/samples/db_query new file mode 100644 index 0000000000..7934b7ccd5 --- /dev/null +++ b/stripchart/samples/db_query @@ -0,0 +1,15 @@ +#! /bin/csh + + + +set CIVDATE = `date "+%Y:%m:%d:%H:%M"` + +set UNIXDATE = `perl -e 'print time()'` + +set DBNAME = `./parse_config db_name` + +set COUNT = `echo "use $DBNAME;$1" | mysql | tail -1` + + + +echo $CIVDATE $UNIXDATE $COUNT diff --git a/stripchart/samples/parse_config b/stripchart/samples/parse_config new file mode 100644 index 0000000000..7bc0778460 --- /dev/null +++ b/stripchart/samples/parse_config @@ -0,0 +1,40 @@ +#!/usr/bin/env python + +# -*- mode: python; python-indent: 4; -*- + + + +## $Id$ + + + +''' + + + +A program to pass config file settings to calling programs via stdout + + + +''' + + + +import boinc_path_config +from Boinc import configxml + +import sys, os + + + +program_path = os.path.realpath(os.path.dirname(sys.argv[0])) + +config_filename = os.path.realpath(os.path.join(program_path, '../config.xml')) + + + +config = configxml.ConfigFile(config_filename).read() + + +print config.config.__dict__.get(sys.argv[1]) +