#!/usr/local/bin/perl

# Get current CODA configuration from mini-SQL database
# We could use the msql perl module, but this is more portable.
$msql = "/usr/local/halld/coda2.5/Linux/bin/msql";
$cmd = "echo \"SELECT config FROM sessions WHERE name='bcaltest'\\\g\" | $msql bcaltest | grep \"|\" | grep -v config";
$config = `$cmd`;
$config =~ s/\s+//g;
$config =~ s/\|//g;

# Store configuration in a file for use by ROCs
#$config_file = "/home/halldrun/coda_config.txt";
$config_file = "/usr/local/halld/config/coda/coda_config.txt";
print "Writing config=\"$config\" to $config_file ...\n";
`rm -f $config_file`;
`echo -n $config > $config_file`;


