Redirecting dbv output to a file


this is a short note for everyone, who is still wondering why a simple shell construct like a redirect operator to a file won’t work for dbv (dbverify).

imagine a situation where you’re about to dbv-scan a good couple of datafiles and want to concatenate the output into a summary file. one approach is, probably, to just redirect/concatenate the output of dbv using >, create or cleanup the file, and >>, append the file, like so (please do not kick me for the weird “>” formatting below, the view plain link will show it correctly):

dbv file=c:\data01.dbf > dbv.log
dbv file=c:\data02.dbf >> dbv.log

however, the resulting file will be empty. the reason is, that for whatever sake, dbv does not write write to channel stdout, as one might expect, but to channel stderr (???). a simple trick to circumvent this issue is to overlay stdout and stderr by writing:

dbv file=c:\data01.dbf > dbv.log 2>&1
dbv file=c:\data02.dbf >> dbv.log 2>&1

here, the channel stdout is denoted by 1 and stderr by 2, respectively. to have it complete, channel stdin is usually identified by 0, if anyone may need to know it.

the same is, by the way, true for loadjava.

regards

Advertisements

One comment

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s