![](/img/trans.png)
[英]How can I see a print statement from a python script running in an EC2 instance?
[英]running a shell script on my local computer that runs a script on aws ec2 instance - How can I follow the ongion output?
我在本地計算機上運行外殼程序腳本,該計算機最終連接到我的aws ec2實例,並在此計算機上運行另一個外殼程序腳本:
ssh -i key.pem ubuntu@$host "bash run_file.sh ${userInput}"
另一個shell腳本“ run_file.sh”如下所示:
#!/bin/bash
PATH=/home/ubuntu/anaconda3/bin:$PATH
source activate pytorch_p36
cd local_directory/libcpab-master/
echo "running ${1}..."
python ${1}
腳本運行后,我將在終端中獲取所有輸出,但我想跟蹤正在進行的輸出。 如何才能做到這一點? 如果可能的話。
您可以將實時輸出和錯誤發送到文件中,打開第二個窗口,然后使用tail -f
選項實時檢查輸出。 您的ssh命令將如下所示:
ssh -i key.pem ubuntu@$host "bash run_file.sh ${userInput} 1>/path/to/logfile 2>>/path/to/logfile "
該文件將在您通過ssh
連接的服務器上生成。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.