67 lines
2.5 KiB
PHP
67 lines
2.5 KiB
PHP
<?php
|
|
// Define path to application directory
|
|
defined('APPLICATION_PATH')
|
|
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
|
|
|
|
// Ensure library/ is on include_path
|
|
set_include_path(implode(PATH_SEPARATOR, array(
|
|
realpath(APPLICATION_PATH . '/../library'),
|
|
get_include_path(),
|
|
)));
|
|
|
|
require_once APPLICATION_PATH.'/configs/config.php';
|
|
require_once 'framework/mail/sendMail.php';
|
|
|
|
define('FTP_STORAGE','/home/data/ftp');
|
|
|
|
//Vérifier montage FTP
|
|
if (file_exists(FTP_STORAGE . DIRECTORY_SEPARATOR . 'test-presence-ftp')) {
|
|
$msg = "Liste des fichiers sur le FTP :\n";
|
|
//Liste des fichiers dans les repertoires
|
|
if (is_dir(FTP_STORAGE)) {
|
|
if ($dh = opendir(FTP_STORAGE)) {
|
|
while (($client = readdir($dh)) !== false) {
|
|
if ( $client !='.' && $client!= '..'
|
|
&& !is_link(FTP_STORAGE . DIRECTORY_SEPARATOR . $client)
|
|
&& is_dir(FTP_STORAGE . DIRECTORY_SEPARATOR . $client) ) {
|
|
|
|
$dirClient = FTP_STORAGE . DIRECTORY_SEPARATOR . $client . '/recv';
|
|
|
|
if ( file_exists($dirClient) ) {
|
|
$msg.= "Dossier Client : ".$client."\n";
|
|
if ($dhFile = opendir($dirClient) ) {
|
|
while (($file = readdir($dhFile)) !== false) {
|
|
|
|
$today = date('Ymd');
|
|
$fileCpt = 0;
|
|
if ( $file !='.' && $file!= '..'
|
|
&& is_file($dirClient . DIRECTORY_SEPARATOR . $file)
|
|
&& preg_match('/_'.$today.'[0-9]{1,}\./', $file)) {
|
|
$msg.= $file."\n";
|
|
$fileCpt++;
|
|
}
|
|
}
|
|
|
|
if ($fileCpt==0) {
|
|
$msg.= "Aucun fichier.\n";
|
|
}
|
|
$msg.= "\n";
|
|
closedir($dhFile);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
closedir($dh);
|
|
}
|
|
}
|
|
sendMail('supportdev@scores-decisions.com','suivi@scores-decisions.com',
|
|
"[CHECK] - FTP ", $msg);
|
|
|
|
} else {
|
|
sendMail(
|
|
'supportdev@scores-decisions.com',
|
|
'suivi@scores-decisions.com',
|
|
"[CHECK] - FTP ",
|
|
"FTP non monté sur la machine Batch (192.168.3.201). Vérifier que le FTP fonctionne!");
|
|
} |