2 # rtorrent-screen 1.0 (Harvie 2oo9)
3 # - Simple rtorrent manager (keeps your torrents in screen transparently + allows you to monitor it using hardcopies)
5 # - Dependencies: bash, screen, rtorrent
6 # - Optionaly webserver with PHP (you will be allowed to monitor your torrents using web interface)
7 # - TODO: adding torrents using web interface...
9 TARGET_DIRECTORY
=~
/downloads
#warning: each user MUST have his own directory for downloading (on "single user" system u can use eg. /srv/http/downloads)
10 SCREEN_PID_FILE
='rtorrent-screen.pid'
11 SCREEN_DUMP_INTERVAL
=30;
12 SESSION_NAME
='rtorrent'
16 CONFIG_OVERRIDE
=~
/.config
/rtorrent-screen.rc.sh
17 #source "$CONFIG_OVERRIDE" 2>/dev/null
19 cd "$TARGET_DIRECTORY";
21 echo Directory
"$TARGET_DIRECTORY" does not exists create it or change path
in "$CONFIG_OVERRIDE" or
in "$0"
22 echo Note that each user MUST have his own separate directory
for rtorrent-screen to avoid collisions.
27 if "$CREATE_PHP_UI"; then
30 <title>Harvie's Downloads</title>
33 * { font-size: small; color: green; background-color: black; }
34 b,i,u { color: lime; }
37 if(is_file('$SCREEN_PID_FILE')) {
39 'rTorrent is running. To attach to it login as <b>$USER</b> and type: <b>$0</b> or <b>screen -x '.
40 htmlspecialchars(file_get_contents('$SCREEN_PID_FILE')).
41 '</b>If you want to detach from it (leave it running on background) press <b>CTRL+a followed by d</b> and if you want to stop rTorrent definitely then press <b>CTRL+q</b> few times.<hr />'.
42 htmlspecialchars(file_get_contents('./hardcopy.0'))
45 echo('rTorrent is not running at this time... To execute it use command: <b>$0</b>');
52 if [[ -r "$SCREEN_PID_FILE" ]]; then
53 screen
-x $
(cat "$SCREEN_PID_FILE");
55 screen
-U -S "$SESSION_NAME" -t "$SESSION_NAME" bash
-c "
58 screen -S \$PPID -X hardcopy;
59 sleep $SCREEN_DUMP_INTERVAL;
62 echo \$PPID > $SCREEN_PID_FILE;
64 rm -f $SCREEN_PID_FILE;
69 echo 'Thank you for using rtorrent-screen by Harvie'