robinbobin ([personal profile] robinbobin) wrote2013-10-30 07:04 am

dropboxd

/etc/init.d/dropboxd



# Dropbox_jc21com startup script
### BEGIN INIT INFO
# Provides: dropbox_jc21com
# Required-Start: $local_fs $network
# Required-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Starts dropbox daemon for jc21com user
# Description: Starts dropbox daemon
### END INIT INFO
RUN_AS_USER=root
DROPBOX_HOME=/root/.dropbox-dist
start() {
  unset DISPLAY
  echo "Starting dropbox: "
  if [ "x$USER" != "x$RUN_AS_USER" ]; then
    su - $RUN_AS_USER -c "$DROPBOX_HOME/dropboxd & >> $DROPBOX_HOME/log.log 2>&1"
  else
    $DROPBOX_HOME/dropboxd & >> $DROPBOX_HOME/log.log 2>&1
  fi
  echo "Done."
}
stop() {
  echo "Shutting down dropbox: "
  if [ "x$USER" != "x$RUN_AS_USER" ]; then
    su - $RUN_AS_USER -c "killall -u $RUN_AS_USER dropbox"
  else
    killall -u $RUN_AS_USER dropbox
  fi
  echo "Done."
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo "Usage: $0 {start|stop|restart}"
esac
exit 0

http://confluence.jc21.com/display/LINUX/Using+Dropbox+on+Linux+headless+server