init
Signed-off-by: Nico Schottelius <nico@manager.schottelius.org>
This commit is contained in:
parent
256dc98754
commit
df2daf524d
641 changed files with 140617 additions and 12 deletions
6
torrent_handler/alle_screens.sh
Executable file
6
torrent_handler/alle_screens.sh
Executable file
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
for screen in $(screen -ls | awk '/Detached/ { print $1 }'); do
|
||||
echo screen -Ux $screen;
|
||||
screen -Ux $screen;
|
||||
done
|
||||
8
torrent_handler/downloader.sh
Executable file
8
torrent_handler/downloader.sh
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
torrent="$1"
|
||||
logfile="$2"
|
||||
echo "Logging to $logfile"
|
||||
|
||||
#btdownloadheadless --max_upload_rate 1 "$torrent" > "$logfile" 2>&1
|
||||
btdownloadheadless --display_interval 10 --max_upload_rate 1 "$torrent" 2>&1 | tee "$logfile"
|
||||
27
torrent_handler/find_succeeded.sh
Executable file
27
torrent_handler/find_succeeded.sh
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# find succussfully downloaded torrents
|
||||
|
||||
TOPABS=$(cd $(dirname $0); pwd -P)
|
||||
TORDIR="$TOPABS/torrents"
|
||||
LOGDIR="$TOPABS/logs"
|
||||
OUTDIR="$TOPABS/out"
|
||||
SAVEDIR="$TOPABS/fertig"
|
||||
SAVETOR="$SAVEDIR/torrents"
|
||||
SEARCHTERM='time left: Download Succeeded!'
|
||||
TESTLINES="20"
|
||||
|
||||
# place downloads into current diretory/out
|
||||
cd "$LOGDIR"
|
||||
|
||||
#for torrent in ${TORDIR}/*; do
|
||||
for log in *; do
|
||||
tail -n${TESTLINES} "$log" | grep -q "$SEARCHTERM" >/dev/null
|
||||
if [ "$?" -eq 0 ]; then
|
||||
echo "$log" finished.
|
||||
file=$(tail -n${TESTLINES} "$log" | awk -F: '/^download to:/ { print $2 }' | tail -n1 | sed 's;^ */;/;')
|
||||
mv "${file}" "${SAVEDIR}"
|
||||
mv "${TORDIR}/${log}" "${SAVETOR}"
|
||||
rm "$log"
|
||||
fi
|
||||
done
|
||||
1
torrent_handler/searchterm
Normal file
1
torrent_handler/searchterm
Normal file
|
|
@ -0,0 +1 @@
|
|||
time left: Download Succeeded!
|
||||
5
torrent_handler/show_log_status.sh
Executable file
5
torrent_handler/show_log_status.sh
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
for file in logs/*;
|
||||
do
|
||||
echo -n "${file}: ";
|
||||
tail -n20 "$file" | grep "percent done:" | tail -n1;
|
||||
done
|
||||
22
torrent_handler/start.sh
Executable file
22
torrent_handler/start.sh
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/sh
|
||||
|
||||
#set -x
|
||||
|
||||
|
||||
TOPABS=$(cd $(dirname $0); pwd -P)
|
||||
TORDIR="$TOPABS/torrents"
|
||||
LOGDIR="$TOPABS/logs"
|
||||
OUTDIR="$TOPABS/out"
|
||||
DNLOADR="$TOPABS/downloader.sh"
|
||||
|
||||
|
||||
rm -f "${LOGDIR}/"*
|
||||
# place downloads into current diretory/out
|
||||
cd "$OUTDIR"
|
||||
|
||||
for torrent in ${TORDIR}/*; do
|
||||
logfile="$LOGDIR/$(basename "$torrent")"
|
||||
#echo screen -d -m btdownloadcurses --max_upload_rate 1 "$torrent" G "$logfile"
|
||||
#screen -d -m btdownloadheadless --max_upload_rate 1 "$torrent" > "$logfile"
|
||||
screen -d -m "$DNLOADR" "$torrent" "$logfile"
|
||||
done
|
||||
8
torrent_handler/stop.sh
Executable file
8
torrent_handler/stop.sh
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
#PIDS=$(ps axuwww | awk '/\/usr\/bin\/btdownloadcurses/ { print $2 }')
|
||||
PIDS=$(ps axuwww | awk '/\/usr\/bin\/btdownloadheadless/ { print $2 }')
|
||||
|
||||
kill -TERM $PIDS
|
||||
sleep 10
|
||||
kill -KILL $PIDS 2>/dev/null
|
||||
Loading…
Add table
Add a link
Reference in a new issue