diff --git a/scripts/runner.pl b/scripts/runner.pl index eefe3fd..dd225c9 100644 --- a/scripts/runner.pl +++ b/scripts/runner.pl @@ -44,14 +44,19 @@ sub update_db_config { open( my $readhandle, '<', $remote_db_conf ) or die "failed to open db.conf: $!"; my @lines; + my $found = 0; while ( my $line = <$readhandle> ) { if ( $line =~ /^database=/ ) { - $line = "database=$db_prefix\_$experiment"; + $line = "database=${db_prefix}_$experiment\n"; + $found = 1; } push @lines, $line; } close($readhandle) or die "failed to close db.conf: $!"; + die "no database= line found in $remote_db_conf for some reason" + unless $found; + open( my $writehandle, '>', $remote_db_conf ) or die "failed to open db.conf: $!"; print( $writehandle, @lines );