Commit dce4a533 authored by Simon Leinen's avatar Simon Leinen

Moved summary generation out to separate script.

parent 9c6454a5
#!/usr/bin/perl -w
use strict;
use warnings;
my $DIR = '/var/www/html/reports';
chdir($DIR) or die "Cannot cd to $DIR: $!";
open OUT, ">index.html" or die "Cannot create index.html: $!";
open REPORTS, "ls -t report-*.txt|" or die "Cannot list reports: $!";
while(<REPORTS>) {
chomp;
printf OUT (" <li><a href=\"%s\">%s</a>\n", $_, $_);
}
close REPORTS or die "Error listing reports: $!";
close OUT or die "Error writing index: $!";
1;
......@@ -6,19 +6,4 @@ DIR=/var/www/html/reports
timestamp="`date +%Y%m%d-%H%M`"
time $HOME/usage-report/usage-report.py > $DIR/report-${timestamp}.txt
cd $DIR || exit 1
perl <<'EOF'
#!/usr/bin/perl -w
open OUT, ">index.html" or die "Cannot create index.html: $!";
open REPORTS, "ls -t report-*.txt|" or die "Cannot list reports: $!";
while(<REPORTS>) {
chomp;
printf OUT (" <li><a href=\"%s\">%s</a>\n", $_, $_);
}
close REPORTS or die "Error listing reports: $!";
close OUT or die "Error writing index: $!";
1;
EOF
$HOME/usage-report/generate-summary.pl
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment