aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2013-12-09 15:05:58 -0500
committerjim-p <jimp@pfsense.org>2013-12-09 15:05:58 -0500
commit694e9f735bb16c7fed83bb26ecaff2ec05a4e1ce (patch)
tree8a317aa73f39b8abc8cead79453a6bf8a3dadb4b
parente15028b099bb506c2571af0ee71416c2f188c630 (diff)
downloadpfsense-packages-694e9f735bb16c7fed83bb26ecaff2ec05a4e1ce.tar.gz
pfsense-packages-694e9f735bb16c7fed83bb26ecaff2ec05a4e1ce.tar.bz2
pfsense-packages-694e9f735bb16c7fed83bb26ecaff2ec05a4e1ce.zip
Quiet down the cron job output from this script when the log doesn't exist.
-rw-r--r--config/postfix/postfix.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/config/postfix/postfix.php b/config/postfix/postfix.php
index a11af2dd..78eb551d 100644
--- a/config/postfix/postfix.php
+++ b/config/postfix/postfix.php
@@ -150,10 +150,13 @@ function grep_log(){
$m=date('M',strtotime($postfix_arg['time'],$curr_time));
$j=substr(" ".date('j',strtotime($postfix_arg['time'],$curr_time)),-3);
# file grep loop
+ $maillog_filename = "/var/log/maillog";
foreach ($postfix_arg['grep'] as $hour){
- print "/usr/bin/grep '^".$m.$j." ".$hour.".*".$grep."' /var/log/maillog\n";
+ if (!file_exists($maillog_filename) || !is_readable($maillog_filename))
+ continue;
+ print "/usr/bin/grep '^".$m.$j." ".$hour.".*".$grep."' {$maillog_filename}\n";
$lists=array();
- exec("/usr/bin/grep " . escapeshellarg('^'.$m.$j." ".$hour.".*".$grep)." /var/log/maillog", $lists);
+ exec("/usr/bin/grep " . escapeshellarg('^'.$m.$j." ".$hour.".*".$grep)." {$maillog_filename}", $lists);
foreach ($lists as $line){
#check where is first mail record
if (preg_match("/ delay=(\d+)/",$line,$delay)){
@@ -294,7 +297,7 @@ function grep_log(){
}
$config=parse_xml_config("{$g['conf_path']}/config.xml", $g['xml_rootobj']);
- print count($config['installedpackages']);
+ //print count($config['installedpackages']);
#start db replication if configured
if ($config['installedpackages']['postfixsync']['config'][0]['rsync'])
foreach ($config['installedpackages']['postfixsync']['config'] as $rs )