incron file en lecture
This commit is contained in:
parent
409758e4f5
commit
3aa3c01931
@ -28,7 +28,9 @@ try {
|
||||
array(
|
||||
'help|?' => "Display usage information.",
|
||||
'list' => "List client and prestations.",
|
||||
'generate-s' => "Generate incron file [client]/[name]",
|
||||
'generate' => "Generate",
|
||||
'send=s' => "Generate send incron file [client]/[name]",
|
||||
'read=s' => "Generate read incron file [client]/[name]",
|
||||
)
|
||||
);
|
||||
$opts->parse();
|
||||
@ -71,30 +73,61 @@ if ($opts->generate)
|
||||
{
|
||||
echo "Generate.\n";
|
||||
|
||||
$input = explode('/', $opts->generate);
|
||||
$client = $input[0];
|
||||
$name = $input[1];
|
||||
if (array_key_exists($client, $prestations))
|
||||
{
|
||||
foreach ($prestations[$client]['prestations'] as $item)
|
||||
if ($opts->send) {
|
||||
|
||||
$input = explode('/', $opts->send);
|
||||
$client = $input[0];
|
||||
$name = $input[1];
|
||||
if (array_key_exists($client, $prestations))
|
||||
{
|
||||
if ($item['name'] == $name)
|
||||
foreach ($prestations[$client]['prestations'] as $item)
|
||||
{
|
||||
$directory = 'send';
|
||||
if (array_key_exists('directory', $item))
|
||||
if ($item['name'] == $name)
|
||||
{
|
||||
$directory = $item['directory'];
|
||||
$directory = 'send';
|
||||
if (array_key_exists('directory', $item))
|
||||
{
|
||||
$directory = $item['directory'];
|
||||
}
|
||||
$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/batchFlux/fileSend.php --file $@/$# >> /home/log/send.log 2>&1");
|
||||
echo "File created $file\n";
|
||||
}
|
||||
$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/batchFlux/fileSend.php --file $@/$#");
|
||||
echo "File created $file\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($opts->read) {
|
||||
|
||||
$input = explode('/', $opts->read);
|
||||
$client = $input[0];
|
||||
$name = $input[1];
|
||||
if (array_key_exists($client, $prestations))
|
||||
{
|
||||
foreach ($prestations[$client]['prestations'] as $item)
|
||||
{
|
||||
if ($item['name'] == $name)
|
||||
{
|
||||
$directory = 'recv';
|
||||
if (array_key_exists('directory', $item))
|
||||
{
|
||||
$directory = $item['directory'];
|
||||
}
|
||||
$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/batchFlux/fileRead.php --file $@/$# >> /home/log/read.log 2>&1");
|
||||
echo "File created $file\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo "Put the file to /etc/incron.d and restart incron.\n";
|
||||
echo "Generate Ended.\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user