Subversion Repositories camp_sysinfo_client_3

Rev

Rev 132 | Rev 143 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 132 Rev 135
Line 16... Line 16...
16
# version 2.1 20191101 RWR
16
# version 2.1 20191101 RWR
17
# changed --name-- tag to name
17
# changed --name-- tag to name
18
#
18
#
19
# version 2.2 20191105 RWR
19
# version 2.2 20191105 RWR
20
# fixed where dmidecode missing caused exception
20
# fixed where dmidecode missing caused exception
-
 
21
#
-
 
22
# version 2.2.1 20191112 RWR
-
 
23
# added timeStamp
21
 
24
 
22
package sysinfoconf;
25
package sysinfoconf;
23
 
26
 
24
 
27
 
25
our $VERSION = '2.2';
28
our $VERSION = '2.2.1';
26
use warnings;
29
use warnings;
27
use strict;  
30
use strict;  
28
 
31
 
29
#use Data::Dumper;
32
#use Data::Dumper;
30
eval( 'use YAML::Tiny' );
33
eval( 'use YAML::Tiny' );
Line 37... Line 40...
37
our @EXPORT = qw( $clientName $serialNumber $hostname @moduleDirs @scriptDirs 
40
our @EXPORT = qw( $clientName $serialNumber $hostname @moduleDirs @scriptDirs 
38
                  $transports $sysinfo3 %sendTypes $binDir $moduleDir
41
                  $transports $sysinfo3 %sendTypes $binDir $moduleDir
39
                  $scriptDir $confDir $binName $confName
42
                  $scriptDir $confDir $binName $confName
40
                  &showConf &transportsToConfig &getAnswer &yesno  
43
                  &showConf &transportsToConfig &getAnswer &yesno  
41
                  &writeConfig &processParameters $TESTING &checkDirectoryExists
44
                  &writeConfig &processParameters $TESTING &checkDirectoryExists
42
                  &runCommand &setDryRun &enableModules &makeConfig &findConf
45
                  &runCommand &setDryRun &enableModules &makeConfig &findConf &timeStamp
43
                );
46
                );
44
 
47
 
45
our $TESTING = 0;
48
our $TESTING = 0;
46
our $dryRun;
49
our $dryRun;
47
our $clientName = '';
50
our $clientName = '';
Line 108... Line 111...
108
                                      ]
111
                                      ]
109
                                   }
112
                                   }
110
                );
113
                );
111
 
114
 
112
 
115
 
-
 
116
#######################################################
-
 
117
#
-
 
118
# timeStamp
-
 
119
#
-
 
120
# return current system date as YYYY-MM-DD HH:MM:SS
-
 
121
#
-
 
122
#######################################################
-
 
123
sub timeStamp {
-
 
124
   my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
-
 
125
   return sprintf "%4d-%02d-%02d %02d:%02d:%02d\n",$year+1900,$mon+1,$mday,$hour,$min,$sec;
-
 
126
}
-
 
127
   
-
 
128
 
113
sub enableModules {
129
sub enableModules {
114
   my $moduleDir = shift;
130
   my $moduleDir = shift;
115
   my %modules;
131
   my %modules;
116
   if ( opendir( my $dh, "$moduleDir" ) ) {
132
   if ( opendir( my $dh, "$moduleDir" ) ) {
117
      %modules = map{ $_ => { 'enabled' => -x "$moduleDir/$_" } } 
133
      %modules = map{ $_ => { 'enabled' => -x "$moduleDir/$_" } }