diff --git a/README b/README index 8310903..c88ceaa 100644 --- a/README +++ b/README @@ -46,13 +46,13 @@ Crontab - incron ================ Exemple surveillance livraison de fichiers par le client -$fluxBasePath IN_CLOSE_WRITE php /home/batchFlux/fileSend.php --file $@/$# >> /home/log/send.log 2>&1 +$fluxBasePath IN_CLOSE_WRITE php /home/batchFlux/fileSend.php --file $@/$# >> /home/flux/shared/send.log 2>&1 Exemple surveillance lecture du fichier mis en dépot -$fluxBasePath IN_CLOSE_NOWRITE,IN_ACCESS,IN_DELETE,IN_NO_LOOP php /home/batchFlux/fileRead.php --file $@/$# >> /home/log/read.log 2>&1 +$fluxBasePath IN_CLOSE_NOWRITE,IN_ACCESS,IN_DELETE,IN_NO_LOOP php /home/batchFlux/fileRead.php --file $@/$# >> /home/flux/shared/read.log 2>&1 Exemple surveillance retour par autre programme de transmission -$fluxBasePath IN_CLOSE_WRITE php /home/batchFlux/fileTck.php --file $@/$# >> /home/log/tck.log 2>&1 +$fluxBasePath IN_CLOSE_WRITE php /home/batchFlux/fileTck.php --file $@/$# >> /home/flux/shared/tck.log 2>&1 Attention, une seule entrée de repertoire peut être saisie dans la incrontab. fileSend a été prévue pour gérer correctement les extension tck diff --git a/buidIncron.php b/buidIncron.php index cfa092c..22aa6e1 100755 --- a/buidIncron.php +++ b/buidIncron.php @@ -41,6 +41,8 @@ if ($displayUsage) { exit; } +$logPath = realpath(__DIR__ . '/../shared'); + $prestations = include APPLICATION_PATH . '/../config.php'; if ($opts->list) @@ -86,7 +88,7 @@ if ($opts->generate) } $fluxBasePath = '/home/data/' . strtolower($item['type']) . '/' . $client . '/' . $directory; $file = __DIR__ . '/incron.d/' . strtolower($item['type']) . '_' . $client; - file_put_contents($file, "$fluxBasePath IN_CLOSE_WRITE php /home/flux/current/send.php --file $@/$# >> /home/log/send.log 2>&1"); + file_put_contents($file, "$fluxBasePath IN_CLOSE_WRITE php /home/flux/current/send.php --file $@/$# >> $logPath/send.log 2>&1"); echo "File created $file\n"; } } @@ -112,7 +114,7 @@ if ($opts->generate) } $fluxBasePath = '/home/data/' . strtolower($item['type']) . '/' . $client. '/' . $directory; $file = __DIR__ . '/incron.d/' . strtolower($item['type']) . '_' . $client . '_recv'; - file_put_contents($file, "$fluxBasePath IN_ACCESS php /home/flux/current/read.php --file $@/$# >> /home/log/read.log 2>&1"); + file_put_contents($file, "$fluxBasePath IN_ACCESS php /home/flux/current/read.php --file $@/$# >> $logPath/read.log 2>&1"); echo "File created $file\n"; } } diff --git a/send.php b/send.php index b01d2c3..b863a85 100644 --- a/send.php +++ b/send.php @@ -45,6 +45,8 @@ if ($displayUsage) { exit; } +$logPath = realpath(__DIR__ . '/../shared'); + // --- Get the file if ( isset($opts->file) ) { @@ -67,7 +69,7 @@ if ( isset($opts->file) ) } // --- Don't play with *.tck files if ($extension == 'tck') { - passthru(__DIR__ . '/tck.php --file '.$opts->file.' >> /home/log/tck.log 2>&1'); + passthru(__DIR__ . '/tck.php --file '.$opts->file.' >> '.$logPath.'/tck.log 2>&1'); exit; } $client = basename(dirname($pathParts['dirname'])); diff --git a/trigger.php b/trigger.php index ae29082..bd8db4a 100644 --- a/trigger.php +++ b/trigger.php @@ -45,6 +45,8 @@ if (empty($opts->file)) { exit; } +$logPath = realpath(__DIR__ . '/../shared'); + $pathParts = pathinfo($opts->file); $filename = $pathParts['basename']; $extension = $pathParts['extension']; @@ -53,16 +55,16 @@ switch($opts->event) { case 'IN_CLOSE_WRITE': if ($extension == 'tck') { - passthru(__DIR__ . '/tck.php --file '.$opts->file.' >> /home/log/tck.log 2>&1'); + passthru(__DIR__ . '/tck.php --file '.$opts->file.' >> '.$logPath.'/tck.log 2>&1'); } else { - passthru(__DIR__ . '/send.php --file '.$opts->file.' >> /home/log/send.log 2>&1'); + passthru(__DIR__ . '/send.php --file '.$opts->file.' >> '.$logPath.'/send.log 2>&1'); } break; case 'IN_ACCESS': case 'IN_CLOSE_NOWRITE': - passthru(__DIR__ . '/read.php --file '.$opts->file.' >> /home/log/read.log 2>&1'); + passthru(__DIR__ . '/read.php --file '.$opts->file.' >> '.$logPath.'/read.log 2>&1'); break; case 'IN_DELETE': - passthru(__DIR__ . '/read.php --file '.$opts->file.' >> /home/log/read.log 2>&1'); + passthru(__DIR__ . '/read.php --file '.$opts->file.' >> '.$logPath.'/read.log 2>&1'); break; }