alanlam123
asked on
Perl script
Hi expert
good day
Is there any example for reference that was generate in perl script to capture patching result or generate report.
such as capture result to capture for the folowing;
Get yum report for Errata info - yum list-sec --security
Get yum list update packages-- yum list updates --security
exclude in vi/etc/yum.conf ( to get information before patch)
yum list-sec --security
yum list updates --security
Get List of updates packages
yum list updates --security
Get installed packages
yum list installed
Get Errata CVE and relate info
yum updateinfo info --security |grep "Update | D\|CVE\|Severity"
The end result will show in the attachment.
Patching-report-sample.xlsx
good day
Is there any example for reference that was generate in perl script to capture patching result or generate report.
such as capture result to capture for the folowing;
Get yum report for Errata info - yum list-sec --security
Get yum list update packages-- yum list updates --security
exclude in vi/etc/yum.conf ( to get information before patch)
yum list-sec --security
yum list updates --security
Get List of updates packages
yum list updates --security
Get installed packages
yum list installed
Get Errata CVE and relate info
yum updateinfo info --security |grep "Update | D\|CVE\|Severity"
The end result will show in the attachment.
Patching-report-sample.xlsx
yum is not a perl statement:
the other way is: using backticks: (man perlop search for qx//)
#!/usr/bin/perl
use strict;
use warnings;
my @cmd=("yum", "update" "--security");
my $yumstatus = system @mycmd;
print "completed\n" ;
See man perlfunc and look for 'system LIST'the other way is: using backticks: (man perlop search for qx//)
#!/usr/bin/perl
use strict;
use warnings;
my $yumoutput = `yum update --security`;
print "completed\n" ;
ASKER
Hi expert
i encountered the following errors show in the following;
syntax error at ./test9.pl line 7, near "print"
Execution of ./test9.pl aborted due to compilation errors.
i use the above script;
#!/usr/bin/perl
use strict
use warnings;
my $yumoutput = `yum update --security`
print "completed\n" ;
i encountered the following errors show in the following;
syntax error at ./test9.pl line 7, near "print"
Execution of ./test9.pl aborted due to compilation errors.
i use the above script;
#!/usr/bin/perl
use strict
use warnings;
my $yumoutput = `yum update --security`
print "completed\n" ;
Aaargh.. ; missing...
(i have no CentOS/RHEL to test this on... , gentoo doesn;t use yum..., so didn't check enough).
Updated other examples as well.
#!/usr/bin/perl
use strict;
use warnings;
my $yumoutput = `yum update --security`;
print "completed\n" ;
(i have no CentOS/RHEL to test this on... , gentoo doesn;t use yum..., so didn't check enough).
Updated other examples as well.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
ASKER
Need some help how to execute yum update --security if I intend use perl script.
I believed some of the missing variable, i use the following script.
#!/usr/bin/perl
use strict
use warnings;
yum update --security
print "completed\n" ;