
| Current Path : /var/www/web-klick.de/dsh/10_customer2017/1204__intel/OptiCM/ToolsAdmin/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/web-klick.de/dsh/10_customer2017/1204__intel/OptiCM/ToolsAdmin/enableDisableOptiCM.pl |
# This script should only be started via opticm -perl
use File::Spec::Functions; # for concatenating pathnames
use strict;
# use warnings; # TODO: Riehm 2011-06-24 turn on warnings!
my $debug = 0;
$debug && print ">>> W A R N I N G R U N N I N G I N D E B U G M O D E <<<\n";
# ToDo: MS 2010-07-23: the script should handle the UNIX flag too: /opt/opticm_unix/cmdata/OptiCM.run
# need exactly one entry for each site
# still using infineon's 3-letter site id's for the time being (2011-06-27)
my $foldersOptiCM = {
AW => "\\\\" . catfile( qw( altsdn01.aw.intel.com opticm cmdata ) ),
BA => "\\\\" . catfile( qw( blrsdn01.iind.intel.com opticm cmdata ) ),
BJ => "\\\\" . catfile( qw( peksdn02.bj.intel.com opticm cmdata ) ),
CE => "\\\\" . catfile( qw( cesdn01.ce.intel.com opticm cmdata ) ),
DG => "\\\\" . catfile( qw( dgsdcara01.dg.intel.com opticm cmdata ) ),
DK => "\\\\" . catfile( qw( opticm.idk.intel.com opticm cmdata ) ),
DR => "\\\\" . catfile( qw( dussd051.dr.intel.com opticm cmdata ) ),
IK => "\\\\" . catfile( qw( iksdn001.ikor.intel.com opticm cmdata ) ),
IKY => "\\\\" . catfile( qw( iksdn003.ikor.intel.com opticm cmdata ) ),
MU => "\\\\" . catfile( qw( mucsdn32.imu.intel.com opticm_ifx cmdata ) ),
NC => "\\\\" . catfile( qw( vlbsdn11.nc.intel.com opticm cmdata ) ),
NI => "\\\\" . catfile( qw( nisdn01.ni.intel.com opticm cmdata ) ),
SG => "\\\\" . catfile( qw( sgsdn01.isng.intel.com opticm cmdata ) ),
SH => "\\\\" . catfile( qw( shasdn01.sh.intel.com opticm cmdata ) ),
TW => "\\\\" . catfile( qw( twsdn02.itwn.intel.com opticm cmdata ) ),
XA => "\\\\" . catfile( qw( xiysdn04.xa.intel.com opticm cmdata ) ),
};
if (grep {$_ =~ /h|-|\//i} @ARGV) {
print "\nSets a semaphore to either enable or disable running of all OptiCM instances"
." in a site\nusage: enableDisableOptiCM.pl stop | run | help\n";
exit 0;
}
my $job = (grep {$_ =~ /stop|disable/i} @ARGV)?'stop':'run';
my $ok = 1;
foreach my $sitecode (sort keys %$foldersOptiCM) {
my $f_stop = catfile( $foldersOptiCM->{ $sitecode } , 'OptiCM.stop');
my $f_run = catfile( $foldersOptiCM->{ $sitecode } , 'OptiCM.run');
my $f1 = ($job eq 'stop')?$f_stop:$f_run;
my $f2 = ($job eq 'stop')?$f_run:$f_stop;
print "\n Configuring OptiCM to >".$job."< in site: >".$sitecode."<\n\n";
if (! -f $f1) {
if ($debug) {
print "OK, Would create file ".$f1."\n";
} elsif (!open(F,">".$f1)) {
print STDERR ">> ERROR: creating file ".$f1."\n";
$ok = 0;
} else {
print F "OptiCM ".uc( $job )." file created\n with ".$0
."\n at ".localtime()."\n by ".lc( $^O =~ /win/i ? getlogin() : getpwuid( $< ) )."\n";
close F;
print "OK, created file ".$f1."\n";
}
} else {
print "OK, file ".$f1." already exists\n";
}
if (-f $f2) {
if ($debug) {
print "OK, unlink file ".$f2."\n";
} elsif (unlink( $f2 )) {
print "OK, removed file ".$f2."\n";
} else {
print STDERR ">> ERROR: removing file ".$f2."\n";
$ok = 0;
}
} else {
print "OK, file ".$f2." not exists\n";
}
}
print "\nFINISHED with ".($ok ? 'SUCCESS':'*** ERRORS ***')."\n";
exit ($ok ? 0 : 1);