public function logout() { $this->log->warn("Logout current user."); if ($this->user) { $kill = sprintf('ps aux | grep Application | grep \'^%s\' | awk \'{print $2}\' | xargs sudo -u %s kill', $this->user, $this->user); $result = trim(shell_exec($kill)); $this->log->debug("Kill process {$result}"); } $cmd = 'osascript -e \'tell application "loginwindow" to «event aevtrlgo»\' 2>&1'; $this->cmd($cmd); }