"Displays usage information.", 'file|f=s' => "Full file path to integrate", 'event=s' => "Event", )); $opts->parse(); } catch (Zend_Console_Getopt_Exception $e) { echo $e->getUsageMessage(); exit; } // --- Usage if( isset($opts->help) || count($opts->getOptions())==0 ) { echo "Proxy Event Trigger.\n"; echo $opts->getUsageMessage(); exit; } // --- Basic file information if (empty($opts->file)) { exit; } $pathParts = pathinfo($opts->file); $filename = $pathParts['basename']; $extension = $pathParts['extension']; switch($opts->event) { case 'IN_CLOSE_WRITE': if ($extension == 'tck') { passthru(__DIR__ . '/fileTck.php --file '.$opts->file.' >> /home/log/tck.log 2>&1'); } else { passthru(__DIR__ . '/fileSend.php --file '.$opts->file.' >> /home/log/send.log 2>&1'); } break case 'IN_ACCESS': passthru(__DIR__ . '/fileRead.php --file '.$opts->file.' >> /home/log/read.log 2>&1'); break; case 'IN_DELETE': passthru(__DIR__ . '/fileRead.php --file '.$opts->file.' >> /home/log/read.log 2>&1'); break; }