Last active
May 10, 2016 12:41
-
-
Save lmammino/8467336 to your computer and use it in GitHub Desktop.
Run dropbox CLI as service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/etc/init.d/dropbox | |
start() { | |
echo "Starting dropbox..." | |
start-stop-daemon -b -o -c dropbox -S -x /dropbox/.dropbox-dist/dropbox | |
} | |
stop() { | |
echo "Stopping dropbox..." | |
start-stop-daemon -o -c dropbox -K -x /dropbox/.dropbox-dist/dropbox | |
} | |
status() { | |
dbpid=$(pgrep -u root dropbox) | |
if [ -z $dbpid ] ; then | |
echo "dropbox not running." | |
else | |
echo "dropbox running." | |
fi | |
} | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! Note that name of the main script has changed from
.dropbox-dist/dropbox
to.dropbox-dist/dropboxd