######################################################################################################### # get dbhost from /usr/sap//SYS/profile/DEFAULT.PFL ######################################################################################################### sub DBhost { my $file = "/usr/sap/$_[0]/SYS/profile/DEFAULT.PFL"; my $search = 'dbhost'; open my $fh, '<', $file or die "open($file,ro) failed: $!"; my $seen = ' '; my $third = ''; LINE: while ( my $line = <$fh> ) { # skip lines without search string next LINE if index( lc($line), lc($search), 0 ) < 0; # extract the third field of line $third = ( split( ' ', $line, ) )[2] // ''; if ($third) { last } # keep the fields uniq #$third unless $third eq $seen; #$seen = $third; } return $third; } ######################################################################################################### # delete OS mails ######################################################################################################### sub DEL_mail { my $sidadm = $_[0]."adm"; my $command = qq( su - $sidadm -c "cat /dev/null > /var/spool/mail/$sidadm" ); system( $command ) == 0 or die "Failed <$command>: $!"; #system ("su - $sidadm -c /" echo //'d *//' | mail -N//""); } ######################################################################################################### # get OS Level ######################################################################################################### sub OS_Level { my $OS_Level; my $osname=$Config{osname}; #print "$osname \n"; switch ($osname) { case "aix" { $OS_Level = `oslevel -r`; } case "linux" { $OS_Level = `cat /etc/issue| awk '{print \$3, \$7, \$8}'| tr "\n" " "| tr -d [:blank:]`; } } #print "$OS_Level \n"; chomp $OS_Level; return $OS_Level; } exit