Archive

Posts Tagged ‘rtorrent’

rtorrent and stream

January 12th, 2009 No comments

Раз в сутки стрим делает реконнект, выдавая при этом новый внешний ип. Небольшой watchdog для rtorrent’а на этот случай.

rtorrent.sh:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh
while true
do
    if [ "`ifconfig | grep ng0`" ];
    then
        if [ "`ifconfig ng0|grep inet`" ];
        then
            ip_s=`ifconfig ng0|grep inet|awk '{print $2}'`
            cat /usr/home/case/.rtorrent.rc.stream | sed -e "s/bind=.*/bind=$ip_s/" | sed -e "s/ip=.*/ip=$ip_s/" > /tmp/1
            mv /tmp/1 /usr/home/case/.rtorrent.rc.stream
            rtorrent -n -o import=/usr/home/case/.rtorrent.rc.stream
        fi
    fi
    sleep 5
done

mpd-down-stream.sh

1
killall -2 rtorrent
Tags: ,