在ubuntu Desktop 12.04 下安装和配置Dropbox

安装Dropbox到Ubuntu desktop中

第一步.在dropbox的官方网址下载

32位下载

Terminal
1
wget -O dropbox.tar.gz "https://www.dropbox.com/download/?plat=lnx.x86"

64位下载

Terminal
1
wget -O dropbox.tar.gz "https://www.dropbox.com/download/?plat=lnx.x86_64"

第二步 解压

Terminal
1
tar -zxvf dropbox.tar.gz

第三步 运行dropbox

Terminal
1
2
3
~/.dropbox-dist/dropboxd
This client is not linked to any account...
Please visit https://www.dropbox.com/cli_link?host_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx to link this machine.

然后在浏览器找开https://www.dropbox.com/cli_link?host_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 输入对应的帐号与密码

在Terminal中提示

Terminal
1
2
3
4
Please visit https://www.dropbox.com/cli_link?host_id=8875df7c703e470dd2dc271aa306d0fb to link this machine.
This client is not linked to any account...
Please visit https://www.dropbox.com/cli_link?host_id=8875df7c703e470dd2dc271aa306d0fb to link this machine.
Client successfully linked, Welcome xxxx!

“Client successfully linked, Welcome xxxx!” 功能以后按 CTRL + C 退出

Terminal
1
2
3
4
ls -ls ~/Dropbox/
total 64
8 drwxrwxr-x 2 john john 4096 Feb 23 16:03 Camera Uploads
8 drwxrwxr-x 2 john john 4096 Feb 26 14:55 Public Shared Folders

你的dropbox的文件将同到到~/Dropbox 下面

让开机自动启动Dropbox

Terminal
1
sudo vi /etc/init.d/dropbox
/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
#!/bin/sh
# dropbox service
DROPBOX_USERS="user1 user2" #替换成你的linux的用户名

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
Terminal
1
2
3
sudo chmod +x /etc/init.d/dropbox
sudo update-rc.d dropbox defaults
sudo service dropbox status

其它的常用的管理dropbox的命令

Terminal
1
sudo service dropbox start|stop|reload|force-reload|restart|status

如何用Python脚本来检查dropbox的状态

1
2
wget -O ~/.dropbox/dropbox.py "https://www.dropbox.com/download?dl=packages/dropbox.py"
chmod +x ~/.dropbox/dropbox.py
dropbox.py
1
2
3
~/.dropbox/dropbox.py status
~/.dropbox/dropbox.py help
~/.dropbox/dropbox.py help exclude

参考:How to Install and Configure Dropbox on Ubuntu Server 12.04

原文地址:http://dlj.bz/N7ACsE

Comments