Created
December 6, 2013 22:16
-
-
Save deckerego/7833072 to your computer and use it in GitHub Desktop.
Dropbox startup script for automated installations
This file contains hidden or 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
#!/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