在ubuntu desktop 12.04 下安装和配置Dropbox
Posted
###安装Dropbox到Ubuntu desktop中 ####第一步.在dropbox的官方网址下载
32位下载 ```bash Terminal wget -O dropbox.tar.gz "https://www.dropbox.com/download/?plat=lnx.x86"
64位下载
```bash Terminal
wget -O dropbox.tar.gz "https://www.dropbox.com/download/?plat=lnx.x86_64"
####第二步 解压 ```bash Terminal tar -zxvf dropbox.tar.gz
####第三步 运行dropbox
```bash Terminal
~/.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中提示 ```bash Terminal 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 退出
```bash Terminal
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 ```bash Terminal sudo vi /etc/init.d/dropbox
```bash /etc/init.d/dropbox
#!/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
```bash Terminal sudo chmod +x /etc/init.d/dropbox sudo update-rc.d dropbox defaults sudo service dropbox status
其它的常用的管理dropbox的命令
```bash Terminal
sudo service dropbox start|stop|reload|force-reload|restart|status
###如何用Python脚本来检查dropbox的状态
wget -O ~/.dropbox/dropbox.py "https://www.dropbox.com/download?dl=packages/dropbox.py"
chmod +x ~/.dropbox/dropbox.py
```bash dropbox.py ~/.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://ubuntuserverguide.com/2012/06/how-to-install-and-configure-dropbox-on-ubuntu-server-12-04.html)
此文章 短链接: http://dlj.bz/1417SU