Opened 12 years ago

Closed 12 years ago

#2026 closed Enhancement (fixed)

Script to check for finished dowloads

Reported by: gaa Owned by: Waldorf
Priority: Normal Milestone: None Set
Component: Wiki Version: 1.51+
Severity: Normal Keywords:
Cc:

Description

I wrote a small script suitable to add into crontab that checks for downloaded torrents and sends email notification to a secified user (only one time for each torrent).

I think that it should be added into scripts wiki page. http://pastie.org/467367

Attachments (2)

checkFinishedTransmissionDownloads.sh (3.3 KB) - added by gaa 12 years ago.
Script that checks for finished downloads in Transmission and sends email to a specified user.
checkFinishedTransmissionDownloads.2.sh (3.4 KB) - added by gaa 12 years ago.
Version 1.1

Download all attachments as: .zip

Change History (9)

Changed 12 years ago by gaa

Script that checks for finished downloads in Transmission and sends email to a specified user.

comment:1 Changed 12 years ago by charles

  • Component changed from Transmission to Wiki
  • Owner set to Waldorf

comment:2 Changed 12 years ago by Waldorf

  • Resolution set to fixed
  • Status changed from new to closed

comment:3 Changed 12 years ago by gaa

  • Resolution fixed deleted
  • Status changed from closed to reopened

Small fix for a script (now 'usage' does not locks lockfile forever):

--- checkFinishedTransmissionDownloads.sh-old 2009-05-04 21:22:26.000000000 +0400 +++ checkFinishedTransmissionDownloads.sh 2009-05-04 21:23:07.000000000 +0400 @@ -14,6 +14,7 @@

# Date | Author <EMail> | Description | #---------------------------------------------------------------------------- # 04 May 2009 | A.Galanin <gaa.nnov AT mail.ru> | Creation |

+# 04 May 2009 | A.Galanin <gaa.nnov AT mail.ru> | Usage moved before locking|

#----------------------------------------------------------------------------

# default configuration options

@@ -63,6 +64,13 @@

}

# initialization

+if [ $# != 0 ] +then + echo "$0: check for finished downloads in Transmission" + echo "USAGE: $0" + exit 1 +fi +

lockfile-create "$LOCK_FILE"
(echo "Unable to lock lockfile!"; exitAndClean 2)

lockfile-touch "$LOCK_FILE" & LOCK_PID="$!"

@@ -76,13 +84,6 @@

# generate netrc file for RPC authorisation printf "machine %s\nlogin %s\npassword %s\n" "$HOST" "$USER" "$PASS" > "$TMP_FILE"

-if [ $# != 0 ] -then

  • echo "$0: check for finished downloads in Transmission"
  • echo "USAGE: $0"
  • exit 1

-fi -

# main callTransmission -l | gawk '{

if ($1 != "Sum:" && $1 != "ID") {

@@ -118,4 +119,3 @@

exitAndClean 0

comment:4 Changed 12 years ago by gaa

Sorry for incorrect formatting:

--- checkFinishedTransmissionDownloads.sh-old   2009-05-04 21:22:26.000000000 +0400
+++ checkFinishedTransmissionDownloads.sh       2009-05-04 21:23:07.000000000 +0400
@@ -14,6 +14,7 @@
 # Date        | Author <EMail>                  | Description               |
 #----------------------------------------------------------------------------
 # 04 May 2009 | A.Galanin <gaa.nnov AT mail.ru> | Creation                  |
+# 04 May 2009 | A.Galanin <gaa.nnov AT mail.ru> | Usage moved before locking|
 #----------------------------------------------------------------------------
 
 # default configuration options
@@ -63,6 +64,13 @@
 }
 
 # initialization
+if [ $# != 0 ]
+then
+    echo "$0: check for finished downloads in Transmission"
+    echo "USAGE: $0"
+    exit 1
+fi
+
 lockfile-create "$LOCK_FILE" || (echo "Unable to lock lockfile!"; exitAndClean 2)
 lockfile-touch "$LOCK_FILE" &
 LOCK_PID="$!"
@@ -76,13 +84,6 @@
 # generate netrc file for RPC authorisation
 printf "machine %s\nlogin %s\npassword %s\n" "$HOST" "$USER" "$PASS" > "$TMP_FILE"
 
-if [ $# != 0 ]
-then
-    echo "$0: check for finished downloads in Transmission"
-    echo "USAGE: $0"
-    exit 1
-fi
-
 # main
 callTransmission -l | gawk '{
     if ($1 != "Sum:" && $1 != "ID") {
@@ -118,4 +119,3 @@
 
 exitAndClean 0

comment:5 Changed 12 years ago by Waldorf

It's just a few lines, don't overcomplicate it by creating a diff ;-) pastebin or attach the updated script. Alternatively, you can pm me in the IRC channel.

Changed 12 years ago by gaa

Version 1.1

comment:6 Changed 12 years ago by gaa

Attached.

comment:7 Changed 12 years ago by Waldorf

  • Resolution set to fixed
  • Status changed from reopened to closed

Thank you! Much appreciated!

Note: See TracTickets for help on using tickets.