From dc3ca0c10a1d115df792647830c452a481ca0af5 Mon Sep 17 00:00:00 2001 From: Razvan Deaconescu Date: Mon, 20 Sep 2010 20:01:51 +0200 Subject: [PATCH] next-share: complete next-share completion detection script --- .../next-share/detect_complete_nextshare.sh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/ControlScripts/clients/next-share/detect_complete_nextshare.sh b/ControlScripts/clients/next-share/detect_complete_nextshare.sh index e828197..3d54a83 100755 --- a/ControlScripts/clients/next-share/detect_complete_nextshare.sh +++ b/ControlScripts/clients/next-share/detect_complete_nextshare.sh @@ -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 -- 2.20.1