Skip to content

Instantly share code, notes, and snippets.

@mmlion

mmlion/dropbox Secret

Created Mar 8, 2017
Embed
What would you like to do?
/etc/init.d/dropbox
#!/bin/sh
# /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 user3"
start() {
echo "Starting dropbox..."
for dbuser in $DROPBOX_USERS; do
echo -n "\t for user $dbuser: "
sudo -u $dbuser /usr/bin/dropbox start
done
}
stop() {
echo "Stopping dropbox..."
for dbuser in $DROPBOX_USERS; do
echo -n "\t for user $dbuser: "
sudo -u $dbuser /usr/bin/dropbox stop
done
}
status() {
for dbuser in $DROPBOX_USERS; do
echo -n "dropboxd for USER $dbuser: "
sudo -u $dbuser /usr/bin/dropbox status
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
@mmlion

This comment has been minimized.

Copy link
Owner Author

@mmlion mmlion commented Mar 8, 2017

Place this file into /etc/init.d/dropbox. Then

sudo chmod +x /etc/init.d/dropbox
sudo update-rc.d dropbox defaults

It will automatically run dropbox daemon for user1 user2 user3.

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.