public function isRunning()
    {
        $this->checkDirExists();

        $pidFile = $this->directory.$this->filename;
        if (!file_exists($pidFile)) {
            return false;
        }

        $pid = file_get_contents($pidFile);
        // Empty pid file means the process is not running
        if (empty($pid)) {
            return false;
        }

        if (!is_dir('/proc/'))
        {
            /* OSX Workaround, not as good as using proc dir on linux, but oh well */
            exec('ps -Ac -o pid | awk \'{print $1}\' | grep \'^'.$pid.'$\'', $output, $return);

            if ($return == 0) {
                // process with the same id is still running
                return true;
            }
        }

        /* we assume the system is a linux system here */
        if (!is_dir('/proc/'.$pid)) {
            // process with the same id is still running
            return false;
        }

        return true;
    }