正在浏览 应用软件 里的文章

运行Dropbox的软件需求

# 2.4 以上版本的C 库
# wget 命令
# Python 2.5
# web 浏览器

安装过程

1、下载

# 切换到home目录
$ cd

# 本例为 32位版本,如果是64bit请将下面的x86换为x86_64即可
$ wget -O dropbox.tar.gz http://www.dropbox.com/download/?plat=lnx.x86

2、解压安装

$ tar -zxof dropbox.tar.gz
$ mv .dropbox-dist ~

3、运行

$ ~/.dropbox-dist/dropboxd &
首次启动dropbox可能需要等待一段时间,client会连接到dropbox服务器,初始化程序,生成标识文件等。~/.dropbox目录就是一些初始化文件,包含了dorpbox共享目录的db等。

4、关闭

$ killall dropbox

5、下载DropboxCLI 维护工具

如果在命令行下操作dropbox,推荐使用官方提供的DropboxCLI工具,下载地址:dropbox.py

$ mkdir -p ~/bin
$ wget -P ~/bin http://www.dropbox.com/download?dl=packages/dropbox.py
$ chmod 755 ~/bin/dropbox.py
$ ~/bin/dropbox.py help
Dropbox command-line interface

commands:

 status       get current status of the dropboxd
 help         provide help
 puburl       get public url of a file in your dropbox
 stop         stop dropboxd
 start        start dropboxd
 filestatus   get current sync status of one or more files
 ls           list directory contents with current sync status

来看一下该命令的应用:
$ ~/bin/dropbox.py status
Connecting...
Downloading 1 file (4.3 KB/sec, 1 hr left)

$ ~/bin/dropbox.py filestatus /data/Documents/Dropbox/
/data/Documents/Dropbox/: up to date

$ ~/bin/dropbox.py ls /data/Documents/Dropbox/
document
game_save
LPDocuments
MyProfile
Photos
Public
software
test

正在同步的文件用特殊的颜色表示,其余的用绿色表示

$ ~/bin/dropbox.py stop
Dropbox daemon stopped.

$ ~/bin/dropbox.py start
Starting Dropbox...Done!

6、如何更改dropbox文件路径

本例将/data/Documents/Dropbox的目录移动到/backup/下

$ ~/bin/dropbox.py stop
$ cp ~/.dropbox/dropbox.db dropbox.db.backup
$ wget http://dl.dropbox.com/u/119154/permalink/dropboxdir.py
$ chmod +x dropboxdir.py
$ mv /data/Documents/Dropbox /backup/
$ ./dropboxdir --setfolder=/backup/
$ ~/bin/dropbox.py start

7、禁止端口广播

默认情况下dropbox会通过17500每隔30秒发送广播包(主要是基于LAN的同步)我们可以暂时关闭广播,通过下载dropboxp2p.py工具来完成:

$ ~/bin/dropbox.py stop
$ cp ~/.dropbox/dropbox.db dropbox.db.backup
$ chmod +x dropboxp2p.py
$ ./dropboxp2p -d
$ ~/bin/dropbox.py stop

如果要重新开启广播,使用-e参数即可。

8、编写守护进程使其随系统一起启动

Debian/Ubuntu
下面是 /etc/init.d/dropbox 脚本文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# dropbox service
# 注意这里的user1 user2,在自己的系统中需要替换成启动脚本的用户
DROPBOX_USERS="user1 user2"

DAEMON=.dropbox-dist/dropbox

start() {
    echo "Starting dropbox..."
    for dbuser in $DROPBOX_USERS; do
        HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
        if [ -x $HOMEDIR/$DAEMON ]; then
            HOME="$HOMEDIR" start-stop-daemon -b -o -c $dbuser -S -u $dbuser -x $HOMEDIR/$DAEMON
        fi
    done
}

stop() {
    echo "Stopping dropbox..."
    for dbuser in $DROPBOX_USERS; do
        HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
        if [ -x $HOMEDIR/$DAEMON ]; then
            start-stop-daemon -o -c $dbuser -K -u $dbuser -x $HOMEDIR/$DAEMON
        fi
    done
}

status() {
    for dbuser in $DROPBOX_USERS; do
        dbpid=`pgrep -u $dbuser dropbox`
        if [ -z $dbpid ] ; then
            echo "dropboxd for USER $dbuser: not running."
        else
            echo "dropboxd for USER $dbuser: running (pid $dbpid)"
        fi
    done
}


case "$1" in
  start)
    start
    ;;

  stop)
    stop
    ;;

  restart|reload|force-reload)
    stop
    start
    ;;

  status)
    status
    ;;

  *)
    echo "Usage: /etc/init.d/dropbox {start|stop|reload|force-reload|restart|status}"
    exit 1

esac

exit 0

将上面的脚本存为/etc/init.d/dropbox 文件,脚本中的 DROPBOX_USERS 变量的作用就是指定可以运行dropbox的用户有哪些,多个用户用空格分隔。

Ubuntu/Debian 运行:
$ chmod +x /etc/init.d/dropbox
$ update-rc.d dropbox defaults

开始服务
$ /etc/init.d/dropbox start

停止服务
$ /etc/init.d/dropbox stop

重启服务
$ /etc/init.d/dropbox restart

检查运行状态
$ /etc/init.d/dropbox status

Fedora/Red hat

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# chkconfig: 345 85 15
# description: Startup script for dropbox daemon
#
# processname: dropboxd
# pidfile: /var/run/dropbox.pid
# config: /etc/sysconfig/dropbox
#

### BEGIN INIT INFO
# Provides: dropboxd
# Required-Start: $local_fs $network $syslog
# Required-Stop: $local_fs $syslog
# Should-Start: $syslog
# Should-Stop: $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start up the Dropbox file syncing daemon
# Description:       Dropbox is a filesyncing sevice provided by dropbox.com
#                    This service starts up the dropbox daemon.
### END INIT INFO


# Source function library.
. /etc/rc.d/init.d/functions

# To configure, add line with DROPBOX_USERS="user1 user2" to /etc/sysconfig/dropbox
# Probably should use a dropbox group in /etc/groups instead.
[ -f /etc/sysconfig/dropbox ] && . /etc/sysconfig/dropbox

prog=dropboxd
lockfile=${LOCKFILE-/var/lock/subsys/$prog}
config=${CONFIG-/etc/sysconfig/dropbox}
RETVAL=0

start() {
        echo -n $"Starting $prog"

        if [ -z $DROPBOX_USERS ] ; then
                echo -n ": unconfigured: $config"
                echo_failure
                echo
                rm -f ${lockfile} ${pidfile}
                RETURN=6
                return $RETVAL
        fi

        for dbuser in $DROPBOX_USERS; do
            daemon --user $dbuser /bin/sh -c "/home/$dbuser/.dropbox-dist/dropboxd&"
        done

        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && touch ${lockfile}
        return $RETVAL
}

status() {
    for dbuser in $DROPBOX_USERS; do
        dbpid=`pgrep -u $dbuser dropbox`
        if [ -z $dbpid ] ; then
            echo "dropboxd for USER $dbuser: not running."
        else
            echo "dropboxd for USER $dbuser: running (pid $dbpid)"
        fi
    done
}

stop() {
        echo -n $"Stopping $prog"
    for dbuser in $DROPBOX_USERS; do
        killproc /home/$dbuser/.dropbox-dist/dropbox
    done
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  status)
        status
        ;;
  stop)
        stop
        ;;
  restart)
        stop
        start
        ;;
  *)
        echo $"Usage: $prog {start|status|stop|restart}"
        RETVAL=3
esac

exit $RETVAL

将文件存为 /etc/init.d/dropbox.
创建 /etc/sysconfig/dropbox 文件,并在文件中设置 DROPBOX_USERS 变量,该变量设置了想要运行dropboxd的用户,多个用户用空格分隔。

$ cat /etc/sysconfig/dropbox
DROPBOX_USERS="user1 user2"

设置文件权限与属性:
/bin/chmod 0755 /etc/init.d/dropbox
/bin/chmod 0644 /etc/sysconfig/dropbox
/bin/ls -l /etc/init.d/dropbox /etc/sysconfig/dropbox

设置 SELinux 许可:
/usr/bin/chcon -u system_u -t initrc_exec_t /etc/init.d/dropbox
/usr/bin/chcon -u system_u -t etc_t /etc/sysconfig/dropbox
/bin/ls -lZ /etc/init.d/dropbox /etc/sysconfig/dropbox

Fedora/RedHat 运行:
chkconfig dropbox on

如果成功可以用chkconfig --list命令看到,如下:
chkconfig --list | egrep '3:on|5:on' | less

运行服务
$ service dropbox start

停止服务
$ service dropbox stop

重启服务
$ service dropbox restart

查看运行状态
service dropbox status

说明:

1、Dropbox是被墙的,这么好的服务~!哎……。若要使用该服务请大家自行翻墙
2、在使用命令行下的dropbox之前,我在gnome环境下已经登陆过,并且设置了网络连接方式,没有试过第一次就在命令行下运行时如何设置连接方式,如下图:
3、感觉daemon的方式运行dropbox要比界面下节省资源
4、本文是翻译Dropbox官方文档的一部分,结合了一些自己的使用心得

原文链接:http://wiki.dropbox.com/TipsAndTricks/TextBasedLinuxInstall

原创文章,转载请注明: 转自 http://salogs.com

Cloudsn 即 Cloud Services Notifications 的简称,它是一款让你获取 Gmail、Google Reader、Twitter、Identi.ca 等相关服务通知的好程序。有了 Cloudsn 的帮助,你就可以即时知晓新的 Gmail 邮件、在 Google Reader 中有多少未读的 RSS 条目、以及新的 tweet 等。

Cloudsn 适用于 GNOME 桌面环境,可从其项目主页下载,Ubuntu 用户也可通过 PPA 安装。
转自:http://linuxtoy.org/archives/cloudsn.html