Commit 9c6454a5 authored by Simon Leinen's avatar Simon Leinen

Added stupid index generation

And put everything in /var/www/html/reports.
parent 991b6856
#!/bin/sh
DIR=/var/www/html/reports
. $HOME/.openrc-leinen
timestamp="`date +%Y%m%d-%H%M`"
time $HOME/usage-report/usage-report.py > report-${timestamp}.txt
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
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