by AndreaCorso
If you had just installed Dropbox Daemon, you need to start it at boot.
For do it, this is a short script that do all the job.
Create a new file in directory /etc/init.d/ give file name dropbox.
sudo nano /etc/init.d/dropbox
Then paste the following script into file:
#!/bin/sh
# dropbox service
# Replace with linux users you want to run Dropbox
# You can use also ONE account
DROPBOX_USERS="firstuser seconduser thirduser"
DAEMON=.dropbox-dist/dropbox
start() {
echo "Starting dropbox..."
for dbuser in $DROPBOX_USERS; do
HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
if [ -x $HOMEDIR/$DAEMON ]; then
HOME="$HOMEDIR" start-stop-daemon -b -o -c $dbuser -S -u $dbuser -x $HOMEDIR/$DAEMON
fi
done
}
stop() {
echo "Stopping dropbox..."
for dbuser in $DROPBOX_USERS; do
HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
if [ -x $HOMEDIR/$DAEMON ]; then
start-stop-daemon -o -c $dbuser -K -u $dbuser -x $HOMEDIR/$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
;;
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
Make sure the script is executable and add it to default system startup run levels
sudo chmod +x /etc/init.d/dropbox
sudo update-rc.d dropbox defaults
Control the Dropbox client like any other Ubuntu service
sudo service dropbox start|stop|reload|force-reload|restart|status