Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/etc/init.d/dropbox
# /etc/init.d/dropbox
### BEGIN INIT INFO
# Provides: dropbox
# Required-Start: $network $syslog $remote_fs
# Required-Stop: $network $syslog $remote_fs
# Should-Start: $named $time
# Should-Stop: $named $time
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop the dropbox daemon for debian/ubuntu
# Description: Dropbox daemon for linux
### END INIT INFO
DROPBOX_USERS="user1 user2"
start() {
echo "Starting dropbox..."
for dbuser in $DROPBOX_USERS; do
start-stop-daemon -b -o -c $dbuser -S -x /home/$dbuser/.dropbox-dist/dropboxd
done
}
stop() {
echo "Stopping dropbox..."
for dbuser in $DROPBOX_USERS; do
start-stop-daemon -o -c $dbuser -K -x /home/$dbuser/.dropbox-dist/dropboxd
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."
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
@migrs

This comment has been minimized.

Copy link
Owner Author

commented Sep 23, 2010

http://wiki.dropbox.com/Regole/TextBasedLinuxInstall のスクリプトでは stop/status 等が動かなかったので一部修正した

@arren-ru

This comment has been minimized.

Copy link

commented Jun 24, 2013

Sorry, but using the user name in a path is wrong on the systems where users not only in /home/.
Maybe using $(getent passwd $DB_USER | cut -d: -f6) will be useful?

PS: Also I am checking existance of .dropbox-dist

PSS: And of course you should change path to the binary in stop function to /.dropbox-dist/dropbox because of shell script in /.dropbox-dist/dropboxd

Cheers )

@mpyusko

This comment has been minimized.

Copy link

commented Feb 5, 2014

This works great, however once a particular user logs into X it exits their instance of the daemon, requiring them to manually restart Dropbox in the graphical environment. Debian (Jessie)

@Gummibeer

This comment has been minimized.

Copy link

commented May 12, 2016

Is there any way to let it work with service dropbox start?

@mmlion

This comment has been minimized.

Copy link

commented Mar 8, 2017

I think its better to add #!/bin/sh at the beginning of the script to make service dropbox start work. Or use this

https://gist.github.com/mmlion/0e42fc48b640f31e9485ae10d95bcc5d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.