Skip to content

Instantly share code, notes, and snippets.

@deckerego
Created December 6, 2013 22:16
Show Gist options
  • Save deckerego/7833072 to your computer and use it in GitHub Desktop.
Save deckerego/7833072 to your computer and use it in GitHub Desktop.
Dropbox startup script for automated installations
#!/bin/bash
#
# ------------------------------------------------------
# Dropbox Startup Script for Unix
# ------------------------------------------------------
# dropbox This shell script takes care of the Dropbox server instance
#
# chkconfig: 2345 80 30
# description: dropbox is liquid awesome
# processname: java
ACTION="$1"
RUN_AS_USER='minecraft'
usage() {
echo "Usage: $0 {start|stop|restart|status}"
exit 1
}
[ $# -gt 0 ] || usage
case "$ACTION" in
start)
su $RUN_AS_USER -c "dropbox start" >> /dev/null 2>&1 &
;;
stop)
su $RUN_AS_USER -c "dropbox stop" >> /dev/null 2>&1 &
;;
restart)
$0 stop $*
sleep 15
$0 start $*
;;
status)
su $RUN_AS_USER -c "dropbox running"
if [[ $? > 0 ]];
then
echo "Dropbox running"
exit 0
else
echo "Dropbox is currently not running."
fi
exit 1
;;
*)
usage
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment