Есть батник, который парсит логи, и если все в порядке, создает файл ok.txt. Если нет, соответственно - ничего не создает. Есть перл скрипт:
#!/usr/bin/perl
#use strict;
use warnings;
use MIME::Lite::TT::HTML;
use MIME::Base64;
use HTML::Template;
use File::stat;
use Time::localtime;
use Encode qw/encode decode/;
my %params;
my $Date = localtime;
$params{INCLUDE_PATH} = 'C:/scripts/bin/Template';
$params{created} = 'ok.png';
$params{uncreated} = 'fail.png';
$params{verified} = 'ok.png';
$params{unverified} = 'fail.png';
my %options;
$options{INCLUDE_PATH} = 'C:/scripts/bin/Template';
my $msg = MIME::Lite::TT::HTML->new(
From => 'postmaster@example.com',
To => 'backup-report@example.com',
Subject => 'Backup-report for' .$Date ,
Type => 'multipart/mixed',
HTMLEncoding => 'base64',
Template => {
html => 'backup.html',
},
Charset => 'utf8',
TmplOptions => \%options,
TmplParams => \%params,
);
$msg->send('smtp','mail.example.com', Timeout => 60 );
Так же есть шаблон, который устраивает меня:
spoiler<p>Report of backup system:</p>
<p>Backup Accounting Bases 1C:</p>
<table border="1" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="width:170px;">
<p>Base Name</p>
</td>
<td style="width:204px;">
<p>Backup Available</p>
</td>
<td style="width:215px;">
<p>Verificated Backup</p>
</td>
</tr>
<tr>
<td style="width:170px;">
<p>1C-1</p>
</td>
<td style="width:204px;"> </td>
<td style="width:215px;"> </td>
</tr>
<tr>
<td style="width:170px;">1C-2</td>
<td style="width:204px;">
<p> </p>
</td>
<td style="width:215px;">
<p> </p>
</td>
</tr>
<tr>
<td style="width:170px;">1C-3</td>
<td style="width:204px;">
<p> </p>
</td>
<td style="width:215px;">
<p> </p>
</td>
</tr>
<tr>
<td style="width:170px;">1C-4</td>
<td style="width:204px;">
<p> </p>
</td>
<td style="width:215px;">
<p> </p>
</td>
</tr>
<tr>
<td style="width:170px;">1C-5</td>
<td style="width:204px;">
<p> </p>
</td>
<td style="width:215px;">
<p> </p>
</td>
</tr>
<tr>
<td style="width:170px;">1C-6</td>
<td style="width:204px;">
<p> </p>
</td>
<td style="width:215px;">
<p> </p>
</td>
</tr>
<tr>
<td style="width:170px;">1C-7</td>
<td style="width:204px;">
<p> </p>
</td>
<td style="width:215px;">
<p> </p>
</td>
</tr>
<tr>
<td style="width:170px;">1C-8</td>
<td style="width:204px;">
<p> </p>
</td>
<td style="width:215px;">
<p> </p>
</td>
</tr>
<tr>
<td style="width:170px;">1C-9</td>
<td style="width:204px;">
<p> </p>
</td>
<td style="width:215px;">
<p> </p>
</td>
</tr>
<tr>
<td style="width:170px;">1C-10</td>
<td style="width:204px;">
<p> </p>
</td>
<td style="width:215px;">
<p> </p>
</td>
</tr>
</tbody>
</table>
<p>Backup Access Control System:</p>
<table border="1" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="width:170px;">Data Type</td>
<td style="width:203px;">
<p>Backup Available</p>
</td>
<td style="width:215px;">
<p>Verificated Backup</p>
</td>
</tr>
<tr>
<td style="width:170px;">
<p>Software Directory</p>
</td>
<td style="width:203px;">
<p> </p>
</td>
<td style="width:215px;">
<p> </p>
</td>
</tr>
<tr>
<td style="width:170px;">
<p>Database</p>
</td>
<td style="width:203px;">
<p> </p>
</td>
<td style="width:215px;">
<p> </p>
</td>
</tr>
</tbody>
</table>
<p>Backup configuration files of Cisco Devices:</p>
<table border="1" cellpadding="0" cellspacing="0" style="width:586px;" width="586">
<tbody>
<tr>
<td style="width:170px;">
<p> Device Name</p>
</td>
<td style="width:208px;">
<p>Backup Available</p>
</td>
<td style="width:208px;">
<p>Verificated Backup</p>
</td>
</tr>
<tr>
<td style="width:170px;">
<p>Router Cisco 2911</p>
</td>
<td style="width:208px;">
<p> </p>
</td>
<td style="width:208px;">
<p> </p>
</td>
</tr>
<tr>
<td style="width:170px;">
<p>Switch Cisco 2960-1.1</p>
</td>
<td style="width:208px;">
<p> </p>
</td>
<td style="width:208px;">
<p> </p>
</td>
</tr>
<tr>
<td style="width:170px;">
<p>Switch Cisco 2960-1.3</p>
</td>
<td style="width:208px;">
<p> </p>
</td>
<td style="width:208px;">
<p> </p>
</td>
</tr>
<tr>
<td style="width:170px;">
<p>Switch Cisco 2960-1.4</p>
</td>
<td style="width:208px;">
<p> </p>
</td>
<td style="width:208px;">
<p> </p>
</td>
</tr>
<tr>
<td style="width:170px;">
<p>Switch Cisco 2960-2.1</p>
</td>
<td style="width:208px;">
<p> </p>
</td>
<td style="width:208px;">
<p> </p>
</td>
</tr>
<tr>
<td style="width:170px;">
<p>Switch Cisco 2960-3.1</p>
</td>
<td style="width:208px;">
<p> </p>
</td>
<td style="width:208px;">
<p> </p>
</td>
</tr>
<tr>
<td style="width:170px;">
<p>Switch Cisco 2960-4.1</p>
</td>
<td style="width:208px;">
<p> </p>
</td>
<td style="width:208px;">
<p> </p>
</td>
</tr>
<tr>
<td style="width:170px;">
<p>Wireless Controller
Cisco WLC 2504</p>
</td>
<td style="width:208px;">
<p> </p>
</td>
<td style="width:208px;">
<p> </p>
</td>
</tr>
</tbody>
</table>
<p>Backup File Database:</p>
<table border="1" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="width:159px;">
<p align="center">Data Type</p>
</td>
<td style="width:215px;">
<p>Backup Available</p>
</td>
<td style="width:215px;">
<p>Verificated Backup</p>
</td></p>
</td>
</tr>
<tr>
<td style="width:159px;">
<p>Database</p>
</td>
<td style="width:215px;"> </td>
<td style="width:215px;"> </td>
</tr>
</tbody>
</table>
<p>Backup User Data from File Server:</p>
<p>Verification of user data directory backup is difficult, because backup software have no verification functional. Report about last incremental backup you can see <a href="file:///\\appserv.example\Logs\Fileserver.log">here</a>.</p>
<p>Backup data from mail server:</p>
<table border="1" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="width:159px;">
<p>Data Type</p>
</td>
<td style="width:215px;">
<p>Backup Available</p>
</td>
<td style="width:215px;">
<p>Verificated Backup</p>
</td>
</tr>
<tr>
<td style="width:159px;">
<p>Mail2DB Scripts</p>
</td>
<td style="width:215px;">
<p> </p>
</td>
<td style="width:215px;">
<p> </p>
</td>
</tr>
</tbody>
</table>
<p>Verification of Mail Server directory backup is difficult, because backup software have no verification functional. Report about last incremental backup you can see <a href="file:///\\appserv.example\Logs\Mail.log">here</a>.</p>
Собственно вопрос: как в шаблоне организовать автоматическую подстановку соответствующего значения, в зависимости от наличия этого файла?