I am using Popen to remote call script
s = Popen(['ssh' , ssh_argument0 , ssh_argument1 , '/tmp/remote/dude_rc_admsvr.sh %s %s' %(DomainHome , ACTIVITY)]) 
stdout = s.communicate()
print stdout
The script is not exiting with the status mentioned under shell script , instead it only prints success or failure status only ..
i want to exit with the status codes as per shell script. here is shell script
tail -Fn0 ${ADM_DOMAIN_LOG} | \
while read LOG_LINE;
do
 echo ${LOG_LINE} | grep -q "${PASS_MSG}"
 if [ $? = 0 ]
 then
   echo "${STATUS_SUCCESS}"
   exit 0
 elif echo ${LOG_LINE} | grep -q "${FAIL_MSG}"
 then
   echo "${STATUS_FAILURE}"
   exit 1
 elif echo  ${LOG_LINE} | grep -q "${FAIL_MSG2}"
 then
    echo "${STATUS_FAILURE}"
    exit 1
 fi
done
exit 
How to get the status code returned ?
 
    