#!/bin/sh FILEPATH="/home/kami/info" CONFIG_FILE="$FILEPATH/config" NOTIFY_FILE="$FILEPATH/notified" ALL_FILE="/tmp/test.all" TMP_FILE="/tmp/test.tmp" LOCK_FILE="/tmp/test" #calltest liefert daten. # main calltest -l | gawk '{ if ($1 != "Sum:" && $1 != "ID") { print $1,$2 } }' | while read id percent do reply="`calltest -t "$id" -i | grep -E '^ Name|^ test'`" #echo $reply name="`echo "$reply" | grep '^ Name' | cut -c 9-`" # check that notification is not yet sent grep -q "$hash" "$NOTIFY_FILE" if [ $? = 1 -a "$percent" = "100%" ] then /home/kami/scripts/checkfiles.pl "-test=$name" /home/kami/scripts/prowl.pl -application=test -event=test "-notification=$name" echo "$hash" >> "$NOTIFY_FILE" fi echo "$hash" >> "$ALL_FILE" done # remove deleted torrents from sent notifications list sort "$NOTIFY_FILE" > "$TMP_FILE" mv "$TMP_FILE" "$NOTIFY_FILE" sort "$ALL_FILE" > "$TMP_FILE" mv "$TMP_FILE" "$ALL_FILE" comm -1 -2 "$NOTIFY_FILE" "$ALL_FILE" > "$TMP_FILE" mv "$TMP_FILE" "$NOTIFY_FILE" exitAndClean 0