#!/usr/bin/perl

use lib "."; use lib "uxmon"; use lib "platforms"; 		#inslib

use BigSister::common;
proginit();

chdir( $BigSister::common::root );
$bsdir = $BigSister::common::root;

$path = $ENV{PATH};
foreach $dir (split( ";", $path )) {
    if( -f "$dir\\perl.exe" ) {
        $perlpath = "$dir\\perl.exe";
        last;
    }
}

if( -f "adm/uxmon-net" ) {
    my $uxmon = "uxmon/uxmon";
    if( -f "bin/uxmon" || -f "bin/uxmon.exe" ) {
	$uxmon = "bin/uxmon";
    }
    Platform::background_process( $perlpath, "perl $uxmon -b $bsdir"
	)|| die ErrorReport();
}

if( -f "adm/bb-display.cfg" ) {
    Platform::background_process( $perlpath, "perl bin/bbd -b $bsdir"
	)|| die ErrorReport();
}

if( -f "adm/bb_event_generator.cfg" ) {
    Platform::background_process( $perlpath, "perl bin/bb_event_generator -b $bsdir -r $bsdir/adm/bb_event_generator.cfg -s $bsdir/www/logs"
	)|| die ErrorReport();
}


sub ErrorReport{
	print Win32::FormatMessage( Win32::GetLastError() );
}
