public function tail(LocalFile $file, $lines, array $options = [])
    {
        $this->options = $options;
        $this->lines = $lines;

        $postfix = $this->getOption('postfix', 'tail');
        $output = $this->getTargetFile($file, $postfix);

        $this->log(LogLevel::INFO, "Retrieving the last {lines} from file {file}", [
            'lines' => $this->lines,
            'file'  => $file,
        ]);

        $cmd = sprintf('tail -n %s %s > %s', $this->lines, $file->getPath(), $output->getPath());

        return $this->processFile($file, $output, $cmd, $this->getOption('keepOldFile', true));
    }
public function tail(LocalFile $file, $lines, array $options = [])
    {
        $this->options = $options;
        $this->lines = $lines;

        $postfix = $this->getOption('postfix', 'tail');
        $output = $this->getTargetFile($file, $postfix);

        $this->log(LogLevel::INFO, "Retrieving the last {lines} from file {file}", [
            'lines' => $this->lines,
            'file'  => $file,
        ]);

        $cmd = sprintf('tail -n %s %s > %s', $this->lines, $file->getPath(), $output->getPath());

        return $this->processFile($file, $output, $cmd, $this->getOption('keepOldFile', true));
    }
public function tail ( LocalFile $ file , $ lines , array $ options = [ ] ) { $ this -> options = $ options ; $ this -> lines = $ lines ; $ postfix = $ this -> getOption ( 'postfix' , 'tail' ) ; $ output = $ this -> getTargetFile ( $ file , $ postfix ) ; $ this -> log ( LogLevel :: INFO , "Retrieving the last {lines} from file {file}" , [ 'lines' => $ this -> lines , 'file' => $ file , ] ) ; $ cmd = sprintf ( 'tail -n %s %s > %s' , $ this -> lines , $ file -> getPath ( ) , $ output -> getPath ( ) ) ; return $ this -> processFile ( $ file , $ output , $ cmd , $ this -> getOption ( 'keepOldFile' , true ) ) ; }
Tail a file

@param LocalFile $file
@param string    $lines         Number of lines to tail (accepts +/- modifiers)
@param array     $options       List of options:
-postfix <string> (Default: tail)
-keepOldFile <bool> (Default: true)

@throws ProcessFailedException
@return LocalFile
Tail a file