Tag Archives: cli

Add dropbox cli as a daemon on ArchLinux

Dropbox can be used as a free cloud backup solution but in order to do so, dropbox has to be added as a service/daemon, simply save the following script as dropboxd in /etc/rc.d/

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

USER=YOUR_USER_NAME
DROPBOXD=/home/$USER/.dropbox-dist/dropboxd
PID=$(pidof -o %PPID $DROPBOXD)
case "$1" in
  start)
    stat_busy "Starting dropboxd"
    [ -z "$PID" ] && sudo -u $USER $DROPBOXD &
    if [ $? -gt 0 ]; then
      stat_fail
    else
      add_daemon dropboxd
      stat_done
    fi
    ;;
  stop)
    stat_busy "Stopping dropboxd"
    [ ! -z "$PID" ]  && kill $PID &> /dev/null
    if [ $? -gt 0 ]; then
      stat_fail
    else
      rm_daemon dropboxd
      stat_done
    fi
    ;;
  restart)
    $0 stop
    sleep 1
    $0 start
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"
esac
exit 0

Now add dropboxd to the daemon list in /etc/rc.conf and voila!