HOME | linux | 在centos 6.x 安裝dropbox(no gui)

在centos 6.x 安裝dropbox(no gui)

2017/04/05/17:24 , Post in linux , 評論(0) , 引用(0) , 閱讀(845) , Via 本站原創
首先下載dropbox相關程式,如果系統是centos x86版本

cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -

接著要安裝python,你可以先檢查python的版本python --version

yum install python

接著與自己的帳號做連接

~/.dropbox-dist/dropboxd

他會給你一個連結,點入後打入自己的帳號密碼即可

接著啟動dropbox

/root/.dropbox-dist/dropboxd start

如果啟用成功應該表示可以了

到dropbox目錄底下檢查是否有同步資料了

cd /root/Dropbox/

接著設定用哪個linux帳號啟用dropbox

vim /etc/sysconfig/dropbox

DROPBOX_USERS="root"

最後寫一個shell去啟用/停用dropbox

touch /etc/init.d/dropbox && chmod 755 /etc/init.d/dropbox && vi /etc/init.d/dropbox



# 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
        dbuser_home=`cat /etc/passwd | grep "^$dbuser:" | cut -d":" -f6`
        daemon --user $dbuser /bin/sh -c "$dbuser_home/.dropbox-dist/dropboxd&"
    done
    RETVAL=$?
    echo
    [ $RETVAL = 0 ] && touch ${lockfile}
    return $RETVAL
}

status() {
    for dbuser in $DROPBOX_USERS; do
        dbpid=`pgrep -u $dbuser dropbox | grep -v grep`
        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
        dbuser_home=`cat /etc/passwd | grep "^$dbuser:" | cut -d":" -f6`
        killproc $dbuser_home/.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


這樣以後要啟用/停用dropbox只需要下

/etc/init.d/dropbox start/stop即可

轉自http://www.dropboxwiki.com/tips-and-tricks/install-dropbox-centos-gui-required

發表評論

暱稱

網址

電郵

開啟HTML 開啟UBB 開啟表情 隱藏 記住我 [登入] [註冊]