several usenet script

processNg.sh 3.1KB

    #!/bin/bash RTORRENTFILE="$HOME/scripts/outputRtorrent.txt" MYFILE="$HOME/scripts/toProcess.txt" BACKUP="$HOME/scripts/oldProcess.txt" ALLBACKUPS="$HOME/scripts/allProcess.txt" NEWZNAB_PATH="/home/newznab/nnplus/misc/update_scripts" FAILEDFILE="$HOME/scripts/outputRtorrent_failed.txt" PAUSEFILE="/tmp/stopNGprocess" START=$(date +%s) trap ctrl_c INT function ctrl_c() { exit 0; } while true; do END=$(date +%s) DIFF=$((END-START)) if [ $DIFF -ge 600 ]; then echo "Deleting failed torrent" $HOME/scripts/delete_failed.sh START=$END fi if [ ! -e $MYFILE ]; then rm -f $BACKUP if [ -e $FAILEDFILE ]; then DATE=$(date) echo $DATE echo "Reprocessing failed getInfo torrent" cp $FAILEDFILE $MYFILE && rm $FAILEDFILE old_IFS=$IFS IFS=$'\n' for line in $(cat $MYFILE); do PARAM1=$(echo $line | awk -F" ¤¤ " '{ print $1 }') #echo "File:" $PARAM1 PARAM2=$(echo $line | awk -F" ¤¤ " '{ print $2 }') #echo "Text:" $PARAM2 PARAM3=$(echo $line | awk -F" ¤¤ " '{ print $3 }') #echo "Text:" $PARAM3 PARAM4=$(echo $line | awk -F" ¤¤ " '{ print $4 }') #echo "Text:" $PARAM4 PARAM5=$(echo $line | awk -F" ¤¤ " '{ print $5 }') #echo "Text:" $PARAM5 PARAM6=$(echo $line | awk -F" ¤¤ " '{ print $6 }') #echo "Text:" $PARAM6 while [[ -e $PAUSEFILE ]]; do echo "NG Process Paused. Run continueNGprocess to continue" sleep 10s done $HOME/scripts/sendng.sh $PARAM1 $PARAM2 $PARAM3 $PARAM4 $PARAM5 $PARAM6 echo "$line" >> $BACKUP echo "$(tail -n +2 $MYFILE)" > $MYFILE done IFS=$old_IFS rm -f $MYFILE cd $NEWZNAB_PATH echo "Newznab Update Releases" RETURN=$(/usr/bin/php5 $NEWZNAB_PATH/update_releases.php) fi if [ -e $RTORRENTFILE ]; then DATE=$(date) echo $DATE echo "Processing new files" cp $RTORRENTFILE $MYFILE && rm $RTORRENTFILE old_IFS=$IFS IFS=$'\n' for line in $(cat $MYFILE); do PARAM1=$(echo $line | awk -F" ¤¤ " '{ print $1 }') #echo "File:" $PARAM1 PARAM2=$(echo $line | awk -F" ¤¤ " '{ print $2 }') #echo "Text:" $PARAM2 PARAM3=$(echo $line | awk -F" ¤¤ " '{ print $3 }') #echo "Text:" $PARAM3 PARAM4=$(echo $line | awk -F" ¤¤ " '{ print $4 }') #echo "Text:" $PARAM4 PARAM5=$(echo $line | awk -F" ¤¤ " '{ print $5 }') #echo "Text:" $PARAM5 PARAM6=$(echo $line | awk -F" ¤¤ " '{ print $6 }') while [[ -e $PAUSEFILE ]]; do echo "NG Process Paused. Run continueNGprocess to continue" sleep 10s done $HOME/scripts/sendng.sh $PARAM1 $PARAM2 $PARAM3 $PARAM4 $PARAM5 $PARAM6 echo "$line" >> $ALLBACKUPS echo "$line" >> $BACKUP echo "$(tail -n +2 $MYFILE)" > $MYFILE done IFS=$old_IFS rm -f $MYFILE cd $NEWZNAB_PATH echo "Newznab Update Releases" RETURN=$(/usr/bin/php5 $NEWZNAB_PATH/update_releases.php) fi fi if [ ! -e $RTORRENTFILE ]; then # echo -n "*" sleep 1m fi done