Skip to content

Instantly share code, notes, and snippets.

@thisismitch
Forked from migrs/dropbox
Last active April 21, 2022 19:12
Show Gist options
  • Select an option

  • Save thisismitch/d0133d91452585ae2adc to your computer and use it in GitHub Desktop.

Select an option

Save thisismitch/d0133d91452585ae2adc to your computer and use it in GitHub Desktop.

Revisions

  1. thisismitch revised this gist Feb 24, 2016. 2 changed files with 42 additions and 32 deletions.
    73 changes: 41 additions & 32 deletions dropbox
    Original file line number Diff line number Diff line change
    @@ -1,28 +1,37 @@
    # /etc/init.d/dropbox
    #!/bin/sh
    ### 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
    # Provides: dropbox
    # Required-Start: $local_fs $remote_fs $network $syslog $named
    # Required-Stop: $local_fs $remote_fs $network $syslog $named
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # X-Interactive: false
    # Short-Description: dropbox service
    ### END INIT INFO

    DROPBOX_USERS="user1 user2"
    [ -f /etc/default/dropbox ] && . /etc/default/dropbox
    mkdir -p /var/run/dropbox
    DAEMON=/opt/dropbox/dropboxd

    start() {
    echo "Starting dropbox..."
    for dbuser in $DROPBOX_USERS; do
    start-stop-daemon -b -o -c $dbuser -S -x /home/$dbuser/.dropbox-dist/dropboxd
    HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
    if [ -x $DAEMON ]; then
    echo "Starting dropbox for $dbuser"
    HOME="$HOMEDIR" start-stop-daemon -b -o -c $dbuser -S -u $dbuser -x $DAEMON -p $HOMEDIR/.dropbox/dropbox.pid
    fi
    done
    }

    stop() {
    echo "Stopping dropbox..."
    for dbuser in $DROPBOX_USERS; do
    start-stop-daemon -o -c $dbuser -K -x /home/$dbuser/.dropbox-dist/dropboxd
    HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
    if [ -x $DAEMON ]; then
    echo "Stopping dropbox for $dbuser"
    start-stop-daemon -o -c $dbuser -K -u $dbuser -p $HOMEDIR/.dropbox/dropbox.pid
    fi
    done
    }

    @@ -32,34 +41,34 @@ status() {
    if [ -z $dbpid ] ; then
    echo "dropboxd for USER $dbuser: not running."
    else
    echo "dropboxd for USER $dbuser: running."
    echo "dropboxd for USER $dbuser: running (pid $dbpid)"
    fi
    done
    }


    case "$1" in
    start)
    start
    ;;

    stop)
    stop
    ;;
    start)
    start
    ;;

    stop)
    stop
    ;;

    restart|reload|force-reload)
    stop
    start
    ;;
    restart|reload|force-reload)
    stop
    start
    ;;

    status)
    status
    ;;
    status)
    status
    ;;

    *)
    echo "Usage: /etc/init.d/dropbox {start|stop|reload|force-reload|restart|status}"
    exit 1
    *)
    echo "Usage: /etc/init.d/dropbox {start|stop|reload|force-reload|restart|status}"
    exit 1

    esac

    exit 0
    exit 0
    1 change: 1 addition & 0 deletions etc-default-dropbox
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    DROPBOX_USERS="sammy"
  2. @migrs migrs renamed this gist Dec 17, 2011. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. @migrs migrs revised this gist Sep 23, 2010. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -7,8 +7,8 @@
    # Should-Stop: $named $time
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Short-Description: Start and stop the dropbox daemon
    # Description: Dropbox daemon for debian/ubuntu
    # Short-Description: Start and stop the dropbox daemon for debian/ubuntu
    # Description: Dropbox daemon for linux
    ### END INIT INFO

    DROPBOX_USERS="user1 user2"
  4. @migrs migrs revised this gist Sep 23, 2010. 1 changed file with 13 additions and 1 deletion.
    14 changes: 13 additions & 1 deletion gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,16 @@
    # dropbox service
    # /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
    # Description: Dropbox daemon for debian/ubuntu
    ### END INIT INFO

    DROPBOX_USERS="user1 user2"
    start() {
    echo "Starting dropbox..."
  5. @migrs migrs revised this gist Sep 23, 2010. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -16,7 +16,7 @@ stop() {

    status() {
    for dbuser in $DROPBOX_USERS; do
    dbpid=`pgrep -u $dbuser dropboxd`
    dbpid=`pgrep -u $dbuser dropbox`
    if [ -z $dbpid ] ; then
    echo "dropboxd for USER $dbuser: not running."
    else
  6. @migrs migrs created this gist Sep 23, 2010.
    53 changes: 53 additions & 0 deletions gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,53 @@
    # dropbox service
    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 dropboxd`
    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