]> p2p-next.cs.pub.ro Git - p2p-testing-infrastructure.git/commitdiff
next-share: complete next-share completion detection script
authorRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Mon, 20 Sep 2010 18:01:51 +0000 (20:01 +0200)
committerRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Mon, 20 Sep 2010 18:01:51 +0000 (20:01 +0200)
ControlScripts/clients/next-share/detect_complete_nextshare.sh

index e828197ef3cfd4e53a9c933aeb76b25ca02fca16..3d54a83673f2e222443bff356e211497b2eca764 100755 (executable)
@@ -20,10 +20,25 @@ fi
 LOG_FILE=$1
 
 while true; do
-       if cat $LOG_FILE | grep DLSTATUS_SEEDING &> /dev/null; then
+       # check for complete transfer
+       if cat $LOG_FILE | grep "DLSTATUS_SEEDING" &> /dev/null; then
+               echo "Torrent transfer finished"
                exit 0
        fi
-       
+
+       if cat $LOG_FILE | grep "Segmentation fault" &> /dev/null; then
+               echo "Segmentation fault when transferring torrent"
+               exit 0
+       fi
+
+       # check stat client is alive
+       if ! pgrep -f "cmdlinedl.py" &> /dev/null; then
+               if ! pgrep -f "schedule_client.sh" &> /dev/null; then
+                       echo "No cmdlinedl.py and no schedule_client.sh process"
+                       exit 0
+               fi
+       fi
+
        # Don't do continuous polling
        sleep 5
 done