分页: 1 / 1

rtorrent+dtach+zenity

发表于 : 2009-08-05 20:48
eexpress
适合tty和gui。

代码: 全选

☎ cat rt
#!/bin/bash

s='/tmp/dtach-rtorrent'
if [[ $(tty) =~ dev ]]; then t=1; else t=0; fi

if [ -e $s ];then       #连接进程
if [ $t -eq 1 ]; then dtach -a $s; else xterm -e dtach -a $s; fi
exit 0;
fi

#启动确定
if [ $t -eq 1 ]; then
        echo "rtorrent没有启动,需要启动?(y)"
        read -n 1 x
        if [ $x != "y" ]; then exit 1; fi
        echo "产生dtach进程"
        dtach -n $s rtorrent
else
        zenity --question --text="rtorrent没有启动,需要启动?"
        if [ $? != "0" ]; then exit 1; fi
        zenity --info --text="产生dtach进程" --timeout=1
        xterm -e dtach -n $s rtorrent
fi