admin 管理员组

文章数量: 887007

树莓派中安装deluge两点小错误

在树莓派中安装deluge搭建下载服务:

 1 ###install:
 2 
 3 root@raspberrypi:~#apt-get install deluged deluge-web
 4 
 5 ###test:
 6 
 7 root@raspberrypi:~#deluged
 8 root@raspberrypi:~#pkill deluged
 9 
10 root@raspberrypi:~#service deluged start
11 deluged: unrecognized service
12 root@raspberrypi:~#service deluge-web
13 deluge-web: unrecognized service

事实上我们确实安装deluged 和deluge-web  deluge 但是这个版本并没有提供init scripts。

我们可以从这里下载一个示例脚本:

 1 root@raspberrypi:~#wget 
 2 root@raspberrypi:~#mv 2191 /etc/init.d/deluge
 3 root@raspberrypi:~#cd /etc/init.d/
 4 root@raspberrypi:~#chmod 755 deluge
 5 root@raspberrypi:~#vim deluge
 6 
 7 #######
 8 #
 9 #USER=username        #Set Username here.
10 #你系统里用来启动的它的用户 我给的是 root
11 ######
12 
13 root@raspberrypi:~#update-rc.d deluge defaults
14 root@raspberrypi:~#service deluge start

这样就可以搞定了,若过不方便下载我这里提供一下bash

 1 #! /bin/sh
 2 ### BEGIN INIT INFO
 3 # Provides:          deluged
 4 # Required-Start:    $network $remote_fs $syslog
 5 # Required-Stop:     $network $remote_fs $syslog
 6 # Default-Start:     2 3 4 5
 7 # Default-Stop:      0 1 6
 8 # Short-Description: Start deluged at boot time
 9 # Description:       Start DelugeD and Deluge-Web.
10 ### END INIT INFO
11 
12 #Author              QuidsUp
13 #Last Edited         26 Jan 2013
14 
15 #Required -- To be changed!
16 USER=root        #Set Username here.
17 PORT=8112            #Set port number for web interface (default 8112)
18 PIDFileDeluge=/var/run/deluged.pid
19 PIDFileWeb=/var/run/deluge-web.pid
20 
21 case "$1" in
22   start)
23     echo "Starting Deluge"
24     start-stop-daemon --start --chuid $USER --name deluged --pidfile $PIDFileDeluge \
25      --background --make-pidfile --exec /usr/bin/deluged -- --do-not-daemonize 
26     start-stop-daemon --start --chuid $USER --name deluge-web --pidfile $PIDFileWeb \
27      --background --make-pidfile --exec /usr/bin/deluge-web -- --port $PORT
28   ;;
29 
30   stop)
31     echo "Stopping Deluge"
32     start-stop-daemon --stop --chuid $USER --name deluged --pidfile $PIDFileDeluge
33     start-stop-daemon --stop --chuid $USER --name deluge-web --pidfile $PIDFileWeb
34   ;;
35 
36   restart|force-reload)
37     echo "Stopping Deluge for Restart"
38     start-stop-daemon --stop --chuid $USER --name deluged --pidfile $PIDFileDeluge
39     start-stop-daemon --stop --chuid $USER --name deluge-web --pidfile $PIDFileWeb
40     sleep 5s
41     echo "Restarting Deluge"
42     start-stop-daemon --start --chuid $USER --name deluged --pidfile $PIDFileDeluge \
43       --background --make-pidfile --exec /usr/bin/deluged -- --do-not-daemonize 
44     start-stop-daemon --start --chuid $USER --name deluge-web --pidfile $PIDFileWeb \
45       --background --make-pidfile --exec /usr/bin/deluge-web -- --port $PORT
46   ;;
47   status)
48     echo "Checking Status of Deluge"
49     if (test -f $PIDFileDeluge); then
50       PIDVal=$(head -1 $PIDFileDeluge)
51       if [ -e /proc/$PIDVal ]; then
52         echo -n "DelugeD Running on Process ID: "
53         echo $PIDVal
54         echo
55         ps -H $PIDVal
56       else
57         echo "DelugeD Not Running but PID File Exists"
58         exit 1
59       fi
60     else
61       echo "No PID File found for DelugeD"      
62     fi
63   ;;
64   *)
65      echo "Usage: deluge {start|stop|restart|force-reload|status}" >&2
66      exit 1
67   ;;
68 esac
69 
70 exit 0

关于忘记deluge密码的处理方式

1.删除web.conf   可以使用find / -name web.conf 来查找文件。

  先停掉deluged 和deluge-web,在删除文件,不过这样,你的deluge的配置和正在下载的都不见了。

2.修改密码,密码在deluge中是用sha1加密的,也就给了我们修改的可能性,官网也给了一段脚本,我在这里修改了一点点。贴出仅供参考,以作记录。

 1 #!/usr/bin/env python                                                                                                                                                                         
 2 # Changes the password for Deluge's Web UI
 3 
 4 from deluge.config import Config
 5 import hashlib
 6 import os.path
 7 #import sys
 8 
 9 #your deluge web.conf path
10 deluge_dir = "/root/.config/deluge/"
11 
12 if os.path.isdir(deluge_dir):
13     try:
14         config = Config("web.conf", config_dir=deluge_dir)
15     except IOError, e:
16         print "Can't open web ui config file: ", e
17     else:
18         password = raw_input("Enter new password: ")
19         s = hashlib.sha1()
20         s.update(config['pwd_salt'])
21         s.update(password)
22         config['pwd_sha1'] = s.hexdigest()
23         try:
24             config.save()
25         except IOError, e:
26             print "Couldn't save new password: ", e
27         else:
28             print "New password successfully set!"
29 else:
30     print "%s is not a directory!" % deluge_dir

 

 

 

转载于:.html

本文标签: 树莓派中安装deluge两点小错误