'Python subprocess.Popen - Count capture using ssh

Here is the ssh command we run to download a file from Mainframe to GCS bucket. Few times the issue is ,it will upload zero byte file , which is creating issue in the process.

Can you help in captuuring the count using the below, so that we can add a retry logic when the command return 0. I. trying to check count in GCS bucket using gsutil command.

subprocess.Popen(["ssh",str(host_name),". " + env_file_path + ";" ,"cfrecv","n:"+mftNode+" zOS:y "+"eb:n"+" lf:"+"\""+downloadPath+tgtdatasetName+"\""+" rf:"+"\""+datasetName+"\""+" sm:y"+" ri:"+str(retryInterval)+" trynum:"+str(retryNumber)])


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source