欢迎光临
我们一直在努力

ubuntu server 14.04安装xware实现迅雷运程下载

下载Xware1.0.31_x86_32_glibc.zip “http://luyou.xunlei.com/thread-12545-1-1.html”
创建一个新用户用来启动xware

sudo useradd thunder

安装xware

sudo unzip Xware1.0.31_x86_32_glibc.zip -p /home/thunder/Xware
sudo chown -R thunder:thunder /home/thunder/Xware

添加服务脚本

#! /bin/sh
### BEGIN INIT INFO
# Provides:          thunder
# Required-Start:    $local_fs $network
# Required-Stop:     $local_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start/stop embed thunder manager
#
# Chkconfig: 2345 91 9
# Description: Start/stop embed thunder manager
### END INIT INFO
#
#

USER=thunder
XWAREPATH=/home/$USER/Xware
RUN=$XWAREPATH/portal
LOG=$XWAREPATH/message.log

PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Embed Thunder Manager"
NAME=thunder
DAEMON=$XWAREPATH/lib/ETMDaemon
DNAME=ETMDaemon
PIDFILE=/var/run/$NAME/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

# Exit if the package is not installed
[ -x "$RUN" ] || exit 5

# Read configuration variable file if it is present
#[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# Define LSB log_* functions. Depend on lsb-base (>= 3.0-6)
. /lib/lsb/init-functions

# start the daemon/service

do_start()
{
    # Return
    #   0 if daemon has been started
    #   1 if daemon was already running
    #   2 if daemon could not be started

    # start_daemon -p $PIDFILE $DAEMON

    # Check if running
    if pidofproc -p $PIDFILE "$DAEMON" > /dev/null 2>&1 ; then
        return 1
    fi

    # Mount
    #umount -l /media/thunder 2>/dev/null
    #mount -B /share/Downloads /media/thunder

    # Run
    su $USER -c "$RUN" > $LOG 2>/dev/null

    # Check result
    local LAST=`cat $LOG | tail -n 1`
    [ "$LAST" = "finished." ] || return 2

    # Check if fail
    FAIL=`cat $LOG | tail -n 4 | grep fail`
    [ "$FAIL" != "" ] && return 2


    # Check ACTIVE CODE
    local MSG=""
    MSG=`cat $LOG | tail -n 4 | grep "ACTIVE CODE"`
    if [ "$MSG" != "" ] ; then
        cat $LOG | tail -n 5 | head -n 4 | while read l; do log_warning_msg $l; done
        return 2
    fi

    # Check if bound
    MSG=`cat $LOG | tail -n 4 | grep "BOUND TO USER"`
    if [ "$MSG" != "" ] ; then
        cat $LOG | tail -n 4 | head -n 3 | while read l; do log_warning_msg $l; done
        [ -e /var/run/$NAME ] || mkdir /var/run/$NAME
        ps aux | grep $DAEMON | grep -v grep | awk '{print $2}' > $PIDFILE
        return 0
    fi

    return 2
}

# stop the daemon/service

do_stop()
{
    # Return
    #   0 if daemon has been stopped
    #   1 if daemon was already stopped
    #   2 if daemon could not be stopped
    #   other if a failure occurred

    # killproc -p $PIDFILE $DAEMON

    local RET=0

    if pidof $DAEMON > /dev/null 2>&1 ; then
        if [ -e $PIDFILE ] && pidof $DAEMON | tr ' ' '\n' | grep -w $(cat $PIDFILE) > /dev/null 2>&1 ; then
            RET=2
        else
            RET=1
        fi
    else
        RET=0
    fi

    # RET is:
    # 0 if Deamon (whichever) is not running
    # 1 if Deamon (whichever) is running
    # 2 if Deamon from the PIDFILE is running

    if [ $RET = 0 ] ; then
        return 1
    elif [ $RET = 2 ] ; then
        su $USER -c "$RUN -s" > $LOG 2>/dev/null
        local COUNT=`cat $LOG | grep -c stopped`
        if [ $COUNT > 0 ] ; then
            # remove pidfile if daemon could not delete on exit.
            rm -f $PIDFILE
            return 0
        else
            FAIL=`cat $LOG | tail -n 1`
            return 2
        fi
    elif [ $RET = 1 ] ; then
        FAIL="There are processes named '$DNAME' running which do not match your pid file which are left untouched in the name of safety, Please review the situation by hand."
        return 2
    fi

    return 2
}

case "$1" in
  start)
    log_daemon_msg "Starting $DESC $NAME"

    do_start

    case "$?" in
        0|1) log_success_msg ;;
        *)   log_failure_msg "$FAIL" ;;
    esac
    ;;
  stop)
    log_daemon_msg "Stopping $DESC $NAME"

    do_stop

    case "$?" in
        0|1) log_success_msg ;;
        2)   log_failure_msg ;;
    esac
    ;;
  restart|force-reload)
    log_daemon_msg "Restarting $DESC $NAME"


    do_stop
    case "$?" in
      0|1)
        sleep 1
        do_start

        case "$?" in
            0) log_success_msg ;;
            1) log_failure_msg ;; # Old process is still running
            *) log_failure_msg ;; # Failed to start
        esac
        ;;
      *)
          # Failed to stop
        log_failure_msg
        ;;
    esac
    ;;
  status)
    status_of_proc -p $PIDFILE $DAEMON $DNAME && exit 0 || exit $?
    ;;
  *)

    log_warning_msg "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
    exit 3
    ;;
esac

:

可直接下载脚本 地址:http://pan.baidu.com/s/1hqBtxtU 提取码:cejt

tar -zxvf thunder.tar.gz
sudo mv thunder /etc/init.d/
sudo chown root:root /etc/init.d/thunder
sudo chmod 755 /etc/init.d/thunder

设置自动运行

sudo update-rc.d thunder defaults 91 09

或者

sudo ln -s /etc/init.d/thunder /etc/rc0.d/K09thunder
sudo ln -s /etc/init.d/thunder /etc/rc1.d/K09thunder
sudo ln -s /etc/init.d/thunder /etc/rc6.d/K09thunder
sudo ln -s /etc/init.d/thunder /etc/rc2.d/S91thunder
sudo ln -s /etc/init.d/thunder /etc/rc3.d/S91thunder
sudo ln -s /etc/init.d/thunder /etc/rc4.d/S91thunder
sudo ln -s /etc/init.d/thunder /etc/rc5.d/S91thunder

手动操作服务

sudo service thunder start
sudo service thunder stop
sudo service thunder status

绑定迅雷
首先启动服务

$ sudo service thunder start
* Starting Embed Thunder Manager thunder
*
* THE ACTIVE CODE IS: BXZAMY
*
* go to http://yuancheng.xunlei.com, bind your device with the active code.

此时会启动失败,但是已获取到激活码,根据提示去http://yuancheng.xunlei.com添加路由器及可绑定成功。
注:有时候迅雷服务器会阻塞,稍后重新启动服务再次获取即可

绑定成功后,再次启动服务

sudo service thunder start
* Starting Embed Thunder Manager thunder
*
* THIS DEVICE HAS BOUND TO USER: User Name.
*
*

已经绑定成功了

挂载硬盘
如果你的主机只有一个硬盘,迅雷远程会提示你没有挂载点,不让你下载。
我这里提供一个简易方法绕过此检查。(其实就是挂一个目录代替设备到挂载点)

sudo mkdir /home/thunder/Downloads
sudo chown thunder:thunder /home/thunder/Downloads
sudo chmod 775 /home/thunder/Downloads
sudo mkdir /media/thunder
sudo mount –bind /home/thunder/Downloads /media/thunder

复制代码
如果要开机自动挂载,则编辑/etc/fstab增加行

/home/thunder/Downloads /media/thunder none bind 0 0

参考资料查看:

http://luyou.xunlei.com/forum.php?mod=viewthread&tid=3290&extra=page%3D1%26filter%3Dtypeid%26typeid%3D3

http://my.oschina.net/u/1382972/blog/285129

赞(0) 打赏
未经允许不得转载:NixonLi博客 » ubuntu server 14.04安装xware实现迅雷运程下载

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏