Install dropbox as service onto Ubuntu/debian server
http://wiki.dropbox.com/TipsAndTricks/UbuntuServerInstall
In this guide I will show you how to setup dropbox backup as service. Some of the following information has been found here
http://wiki.dropbox.com/TipsAndTricks/TextBasedLinuxInstall
Disclaimer
Even I tried myself this command sequence you are informed and you must accept any risks deriving from these documentation usage and you cannot claim any damages to me for your own actions.
Prerequisites
Registration and creating the account procedures could be complete in a more intuitive way using the graphical user interface (GUI) if you have at least one Linux box onto which forward display X connection. In order to be able to remote the GUI you should start from that linux box and allow X forwarding:
xhost +server_ip
ssh -X user_name@server_ip
It was reported that it would be possible to install DropBox following the next instructions and not forwarding X (at least it was done in Debian squeeze). Don't run export DISPLAY. When you run dropboxd, it will print onto the text console a URI to activate the account. Copy that URI into your browser and proceed to creation of a Dropbox account. A few seconds after visiting that uri, dropboxd will complain it cannot run nautilus. Just ignore it and continue with the steps.
How to, step by step
sudo -s
groupadd dropbox
useradd -r -d /etc/dropbox -g dropbox -s /bin/false dropbox
wget -O /tmp/dropbox.tar.gz http://www.dropbox.com/download/?plat=lnx.x86
mkdir -p /usr/local/dropbox /etc/dropbox
chown dropbox.dropbox /etc/dropbox
chmod 700 /etc/dropbox
tar xvzf /tmp/dropbox.tar.gz -C /usr/local/dropbox --strip 1
rm /tmp/dropbox.tar.gz
su -l dropbox -s /bin/bash
umask 0027
# the next line is useful only if you a linux box with X
export DISPLAY=10.0.XX.YY:0.0
/usr/local/dropbox/dropboxd
# register a new account and/or register this machine
exit
cat <<EOF | sed -e "s,%,$,g" >/etc/init.d/dropbox
### BEGIN INIT INFO
# Provides: dropbox
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the dropbox service
# Description: starts dropbox using start-stop-daemon
### END INIT INFO
DROPBOX_USERS="dropbox"
DAEMON=/usr/local/dropbox/dropbox
unset DISPLAY
start() {
echo "Starting dropbox..."
for dbuser in %DROPBOX_USERS; do
HOMEDIR=%(getent passwd %dbuser | cut -d: -f6)
if [ -x %DAEMON ]; then
HOME="%HOMEDIR" start-stop-daemon -b -o -c %dbuser -S -u %dbuser -x %DAEMON
fi
done
}
stop() {
echo "Stopping dropbox..."
for dbuser in %DROPBOX_USERS; do
HOMEDIR=%(getent passwd %dbuser | cut -d: -f6)
if [ -x %DAEMON ]; then
start-stop-daemon -o -c %dbuser -K -u %dbuser -x %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
sleep 1
status
;;
stop)
stop
sleep 1
status
;;
restart|reload|force-reload)
stop
start
sleep 1
status
;;
status)
status
;;
*)
echo "Usage: /etc/init.d/dropbox {start|stop|reload|force-reload|restart|status}"
exit 1
esac
exit 0
EOF
chmod a+x /etc/init.d/dropbox
update-rc.d dropbox defaults
/etc/init.d/dropbox start