I'm inheriting admin control over a server used to process and share data between investigators. We've been trying to use Dropbox to share some of the files. Dropbox was installed when I took over the server, so it seemed like an easy method. However, I can't get Dropbox to stay running consistently.
I initially linked my account to Dropbox using the GUI in an X session. I added the Dropbox CLI interface (dropbox.py) and an init.d entry to start it as a daemon, using one of the many examples I found online (currently init.d script is modeled after this one, see below for the actual script).
When I reboot the server calling service dropbox status
returns that it is running, but dropbox.py states it is not, and nothing syncs. If I manually start using dropbox.py, everything syncs - but the dropbox service reports it as not running. If I manually start via service dropbox start
, the service reports itself as not running but dropbox.py reports it as syncing. Whenever I log in and fix it, everything seems to run fine for a day or two, but then it stops syncing again.
I've tried killing the init.d script, removing all entries and reinstalling. I've tried reinstalling Dropbox via command line. I cannot seem to figure out what the issue is, and the examples I'm finding elsewhere all assume the server is running headless only (which it isn't - several users are primarily accessing it via remote desktop).
I don't care if Dropbox starts on GUI login or not, I just want it running in the background at all times, whether I am logged in or not. And I definitely don't want it to stop if I log in (either CLI or X session), which I have read can happen depending on how it's started initially.
(Dropbox 2.10.3, x64, on Ubuntu 12.04.5 LTS)
Any suggestions?
init.d/dropbox script in use (example here uses dummy user name):
#!/bin/sh
### BEGIN INIT INFO
# Provides: dropbox
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs $remote_fs $network $syslog $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Interactive: false
# Short-Description: dropbox service
### END INIT INFO
# Replace with linux users you want to run Dropbox clients for
DROPBOX_USERS="my_user_name"
start() {
echo "Starting dropbox..."
for dbuser in $DROPBOX_USERS; do
HOMEDIR=$(getent passwd $dbuser | cut -d: -f6)
DAEMON=$(find $HOMEDIR/.dropbox-dist/dropbox-lnx.* -name dropboxd)
if [ -x $DAEMON ]; then
HOME="$HOMEDIR" start-stop-daemon -b -o -c $dbuser -S -u $dbuser -x $DAEMON -p "$HOMEDIR/.dropbox/dropbox.pid"
fi
done
}
stop() {
echo "Stopping dropbox..."
for dbuser in $DROPBOX_USERS; do
HOMEDIR=$(getent passwd $dbuser | cut -d: -f6)
DAEMON=$(find $HOMEDIR/.dropbox-dist/dropbox-lnx.* -name dropbox)
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=`ps -u $dbuser -o pid,cmd | grep "$HOMEDIR"/"$DAEMON"\$ | awk '{ print \$1 }'`
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