blob: dfbcb41a0f2dedbcd6e3c03ea1836cf850b40d1e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#!/usr/bin/env perl
use strict;
use warnings;
use Template;
use POSIX qw(strftime);
my $outfile = "/var/lib/sitesummary/www/index.html";
my $tplfile = "/usr/share/sitesummary/www/default.html";
my $tpl = Template->new();
my @cmds = qw(
site-summary
hostclass-summary
kernelversion-summary
agesinceseen-summary
hardware-model-summary
debian_edu-version
);
my $vars = {};
for my $cmd (@cmds) {
$vars->{'results'}->{$cmd} = `/usr/lib/sitesummary/$cmd`;
}
$vars->{'last_updated'} = strftime("%a %b %d %H:%M:%S %Z %Y", localtime);
$tpl->process($tplfile, $vars, \&write_out);
exit 0;
sub write_out {
my $output = shift;
open FH, ">$outfile";
print FH "$output";
close FH;
}
|