如何从单个bash脚本中的不同终端(每个具有不同的PID)运行不同的python文件?

时间:2018-04-05 14:38:25

标签: python bash

我有3个python文件存储在不同的文件夹中。我需要这些文件在不同的终端上运行。我也尝试了here给出的解决方案,但这不是我想要实现的。到目前为止,这是我的代码:

  

RPI_GATEWAY_LAUNCHER.py

#!/bin/sh

###### STARTING UP NRF MODULE #####
sleep 2
cd Desktop/RPI_GATEWAY/NRF24L01
python NRF_MQTT.py
sleep 5
###################################

#### STARTING UP TEST MODULE 1 ####
cd Desktop/RPI_GATEWAY/TEST
python TEST_PUB_1.py
sleep 2
###################################

#### STARTING UP TEST MODULE 2 ####
cd Desktop/RPI_GATEWAY/TEST
python TEST_PUB_2.py
sleep 2
###################################

1 个答案:

答案 0 :(得分:0)

你可以试试:

final RequestQueue requestQueue = Volley.newRequestQueue(this);
final String url ="http://mykulwstc000006.kul/Services/Customer/Register";
Map<String, String>  params = new HashMap<String, String>();
params.put("MobileNumber", "+97333765439");
params.put("EmailAddress", "danish.hussain4@das.com");
params.put("FirstName", "Danish2");
params.put("LastName", "Hussain2");
params.put("Country", "BH");
params.put("Language", "EN");
JsonObjectRequest req = new JsonObjectRequest(url, new JSONObject(params),
        new Response.Listener<JSONObject>() {
            @Override
            public void onResponse(JSONObject response) {
                try {
                    VolleyLog.v("Response:%n %s", response.toString(4));
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        }, new Response.ErrorListener() {
    @Override
    public void onErrorResponse(VolleyError error) {
        VolleyLog.e("Error: ", error.getMessage());
    }
}){
    @Override
    public String getBodyContentType() {
        return "application/json; charset=utf-8";
    }

    @Override
    public Map<String, String> getHeaders() throws AuthFailureError {
        String username ="eli@gmail.com";
        String password = "elie73";

        String auth =new String(username + ":" + password);
        byte[] data = auth.getBytes();
        String base64 = Base64.encodeToString(data, Base64.NO_WRAP);
        HashMap<String, String> headers = new HashMap<String, String>();
        headers.put("Authorization","Basic "+base64);
        return headers;
    }

};
requestQueue.add(req);