Dropbox

From Attie's Wiki
Jump to: navigation, search

On Ubuntu Server 14.04

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

/usr/bin/dropbox

From here: dropbox.py

/etc/init.d/dropbox

#!/bin/sh
#dropbox service
# modified by Attie Grande <attie@attie.co.uk>
# original from http://www.dropboxwiki.com/tips-and-tricks/install-dropbox-in-an-entirely-text-based-linux-environment
# place the file at /etc/init.d/dropbox
# then:
#  # chmod 755 /etc/init.d/dropbox
#  # update-rc.d dropbox defaults
 
DROPBOX_USERS="attie"
 
DAEMON=dropboxd
DAEMON_PATH=.dropbox-dist/${DAEMON}
PID_PATH=.dropbox/dropbox.pid
TASK_BIN=dropbox
 
start() {
	echo "Starting dropbox..."
	for USER in ${DROPBOX_USERS}; do
		DIR="$(getent passwd "${USER}" | cut -d : -f 6)"
		BIN="${DIR}/${DAEMON_PATH}"
		if [ -x "${BIN}" ]; then
			echo "    starting for ${USER}..."
			HOME="${DIR}" start-stop-daemon -b -o -c "${USER}" -S -u "${USER}" -p "${DIR}/${PIDPATH}" -x "${BIN}"
		fi
	done
}
 
stop() {
	echo "Stopping dropbox..."
	for USER in ${DROPBOX_USERS}; do
		DIR="$(getent passwd "${USER}" | cut -d : -f 6)"
		DBPID=$(pgrep -u "${USER}" "${TASK_BIN}")
		if [ ! -z ${DBPID} ] ; then
			echo "    stopping for ${USER}..."
			echo -e "tray_action_hard_exit\ndone\n" | nc -U "${DIR}/.dropbox/command_socket"
		fi
	done
}
 
status() {
	for USER in ${DROPBOX_USERS}; do
		DBPID=$(pgrep -u "${USER}" "${TASK_BIN}")
		if [ -z ${DBPID} ] ; then
			echo "dropboxd for ${USER}: not running."
		else
			echo "dropboxd for ${USER}: running (pid ${DBPID})"
		fi
	done
}
 
case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	restart|reload|force-reload)
		stop
		start
		;;
	status)
		status
		;;
	*)
		echo "Usage: $0 {start|stop|reload|force-reload|restart|status}"
		exit 1
esac
 
exit 0
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox