From: Razvan Deaconescu Date: Thu, 5 Aug 2010 14:47:55 +0000 (+0300) Subject: ControlScripts: add "process terminated" detection in hrktorrent detect script X-Git-Tag: schedule-scenario X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=commitdiff_plain;h=51f97045dce6fe1a7da9e9c71db0a8b5ac5d89d9;p=p2p-testing-infrastructure.git ControlScripts: add "process terminated" detection in hrktorrent detect script --- diff --git a/ControlScripts/detect_complete_hrk.sh b/ControlScripts/detect_complete_hrk.sh index 2ae8f01..c8229d4 100755 --- a/ControlScripts/detect_complete_hrk.sh +++ b/ControlScripts/detect_complete_hrk.sh @@ -2,12 +2,18 @@ # # Copyright: George Milescu 2010 - george.milescu@gmail.com # -# Bash script used to detect when a regular client finished downloading a torrent +# 2010, Razvan Deaconescu, razvan.deaconescu@cs.pub.ro +# - take into account when the BitTorrent client is stopped +# +# Bash script used to detect when a regular client finished +# downloading a torrent +# # The script # * monitors a log file provided as an argument # * as long as the doe is not finished the script keeps running # * when the doe is finished it returns 0 -# * blocks the caller - the script exits only when the doe has completed the download +# * blocks the caller - the script exits only when the doe has completed +# the download # # Script arguments: # * log file @@ -20,14 +26,16 @@ fi LOG_FILE=$1 while true; do + # check for complete transfer if cat $LOG_FILE | grep "Torrent finished" &> /dev/null; then exit 0 fi - - if cat $LOG_FILE | grep "Segmentation fault" &> /dev/null; then + + # check stat client is alive + if ! pgrep "hrktorrent" &> /dev/null; then exit 0 fi - + # Don't do continuous polling sleep 5 done