使用Python3或Bash,如何将ctrl + a d发送到我的程序?

时间:2018-04-22 16:14:43

标签: bash python-3.x gnu-screen

我知道这个问题已被问过几次,而我所看到的答案是screen -m -d

似乎将我的情况分开是因为我试图在该屏幕上运行tcpdump,当我将tcpdump与-m -d结合使用时,tcpdump永远不会运行。它适用于touch之类的东西,我已经看到它在答案中用作一个例子,所以我似乎在正确的轨道上。

我设想的解决方案是打开屏幕,tcpdump开始运行,然后我将ctrl + ad发送到屏幕会话,以便它可以继续运行,只要用户需要。

感谢您的帮助。

1 个答案:

答案 0 :(得分:2)

启动-d -m时使用screen以避免首先附加到screen -d -m tcpdump

 <?php
session_start();
// added in v4.0.0
require_once 'autoload.php';

use Facebook\FacebookSession;
use Facebook\FacebookRedirectLoginHelper;
use Facebook\FacebookRequest;
use Facebook\FacebookResponse;
use Facebook\FacebookSDKException;
use Facebook\FacebookRequestException;
use Facebook\FacebookAuthorizationException;
use Facebook\GraphObject;
use Facebook\Entities\AccessToken;
use Facebook\HttpClients\FacebookCurlHttpClient;
use Facebook\HttpClients\FacebookHttpable;

// start session

// init app with app id and secret
FacebookSession::setDefaultApplication( '367245673760849','my secret goes here' );

// login helper with redirect_uri

    $helper = new FacebookRedirectLoginHelper('http://saturnproduction.com/test.php' );

try {
  $session = $helper->getSessionFromRedirect();
} catch( FacebookRequestException $ex ) {
  // When Facebook returns an error
} catch( Exception $ex ) {
  // When validation fails or other local issues
}

// see if we have a session
if ( isset( $session ) ) {
  // graph api request for user data
  $request = new FacebookRequest( $session, 'GET', '/me' );
  $response = $request->execute();
  // get response
  $graphObject = $response->getGraphObject();

        $fbid = $graphObject->getProperty('id');              // To Get Facebook ID
        $fbuname = $graphObject->getProperty('username');  // To Get Facebook Username
        $fbfullname = $graphObject->getProperty('name'); // To Get Facebook full name
        $femail = $graphObject->getProperty('email');    // To Get Facebook email ID
    /* ---- Session Variables -----*/
        $_SESSION['FBID'] = $fbid;           
        $_SESSION['USERNAME'] = $fbuname;
        $_SESSION['FULLNAME'] = $fbfullname;
        $_SESSION['EMAIL'] =  $femail;
    echo '<pre>' . print_r( $graphObject, 1 ) . '</pre>';
} else {
  // show login url
  echo '<a href="' . $helper->getLoginUrl() . '">Login</a>';
}

?>