#!/usr/bin/perl

use lib "."; use lib "uxmon"; use lib "platforms"; 		#inslib
use BigSister::common;
proginit();

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

foreach $daemon ("bbd", "bb_event_generator", "uxmon") {
    if( -f "$BigSister::common::fs{'run'}/$daemon.pid" ) {
	open( IN, "<$BigSister::common::fs{'run'}/$daemon.pid" );
	chomp( $pid = <IN> ); 
	close IN;
	print "$daemon is pid $pid\n" if( $BigSister::common::dl );
	if( ($pid>0) && kill( 1, $pid ) ) {
	    unlink( "$BigSister::common::fs{'run'}/$daemon.pid" );
	    print "$daemon stopped\n";
	}
    }
}


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