Use of uninitialized value in numeric eq (==) at ./nano.pl line 51. Use of uninitialized value in numeric eq (==) at ./nano.pl line 51. Use of uninitialized value in concatenation (.) or string at ./nano.pl line 54. FLAG2 LoginTime Feature : nano FLAG lmstat : lmstat -c 12345@toto -f nano/ace_cosim FLAG lmstat : lmstat -c 12345@toto -f nano/gui FLAG lmstat : lmstat -c 12345@toto -f nano/power FLAG1 resultat command slesne pascal /dev/pts/31 (v2007.030) (toto@12345 337), start Mon 2/20 15:49
Use of uninitialized value in numeric eq (==) at ./nano.pl line 51. Use of uninitialized value in numeric eq (==) at ./nano.pl line 51. Use of uninitialized value in concatenation (.) or string at ./nano.pl line 54. FLAG2 LoginTime Feature : nano/power
L'erreur doit venir de la dernière séquence du programme je pense.
Marsh Posté le 20-02-2012 à 16:15:58
Bonjour j'ai un souci avec un script ,
********************************
#!/usr/bin/perl
use warnings;
use strict;
use POSIX;
#LocalTime2UnixTime :
my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =localtime(time);
$year += 1900;
my $local_unixtime = mktime ($sec, $min, $hour, $mday, $mon+1, $year-1900,-1,-1,-1);
my $login0 ;
my $login1;
my $login2 ;
my $login_time;
my $feature;
my @feature = qw(nano nano/ace_cosim nano/gui nano/power );
foreach my $feat (@feature) {
print "FLAG lmstat : lmstat -c 12345\@toto -f $feat \n";
my @command=`/home/toto/lmutil lmstat -c 12345\@toto -f $feat`;
foreach my $check (@command) {
if ($check =~ /start/) {
print "FLAG1 resultat command $check\n";
my @check=split (/ /,$check);
$login0=$check[4];
$login0=$login1 ;
# Calcul d'utilisation
my $time_start=$check[13];
my $date_start=$check[12];
chomp ($time_start);
chomp ($date_start);
# On écrase localTime avec les valeur trouvée
($hour, $min ) = split/,$time_start;
($mon, $mday ) = split/\//,$date_start;
# TimesUse2UnixTimes
my $unixtime = mktime ($sec, $min, $hour, $mday, $mon, $year- 1900,-1,-1,-1 );
my $diff= $local_unixtime - $unixtime ;
my $heures_util=int($diff / 3600);
# Envoi du temps abusif
if ($heures_util >=24 || $login1 == $login2 ) {
$login_time=$login1;
$feature=$feat;
print " FLAG2 LoginTime Feature : $login_time $feature\n";
$login0=$login2;
}
}
}
}
**************************************
Le programme me retourne :
FLAG lmstat : lmstat -c 12345@toto -f nano
FLAG1 resultat command slesne pascal /dev/pts/31 (v2007.030) (toto/12345 223), start Mon 2/20 15:49
Use of uninitialized value in numeric eq (==) at ./nano.pl line 51.
Use of uninitialized value in numeric eq (==) at ./nano.pl line 51.
Use of uninitialized value in concatenation (.) or string at ./nano.pl line 54.
FLAG2 LoginTime Feature : nano
FLAG lmstat : lmstat -c 12345@toto -f nano/ace_cosim
FLAG lmstat : lmstat -c 12345@toto -f nano/gui
FLAG lmstat : lmstat -c 12345@toto -f nano/power
FLAG1 resultat command slesne pascal /dev/pts/31 (v2007.030) (toto@12345 337), start Mon 2/20 15:49
Use of uninitialized value in numeric eq (==) at ./nano.pl line 51.
Use of uninitialized value in numeric eq (==) at ./nano.pl line 51.
Use of uninitialized value in concatenation (.) or string at ./nano.pl line 54.
FLAG2 LoginTime Feature : nano/power
L'erreur doit venir de la dernière séquence du programme je pense.
Merci d'avance,