Created
May 24, 2015 03:04
-
-
Save bpteam/1fa6d93e85da93c84ec0 to your computer and use it in GitHub Desktop.
db init
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
#!/bin/sh | |
#dropbox service | |
DBU='user_name' #Ваш пользователь в системе под которым будет работать DropBox | |
DAEMON='/path/to/.dropbox-dist/dropboxd' #адрес к исполняемому файлу | |
HOMEDIR='/home/'$DBU'/Dropbox' #Папка для синхронизации | |
start() { | |
echo 'Starting dropbox...' | |
if [ -x $DAEMON ]; then | |
HOME=$HOMEDIR start-stop-daemon -b -o -c $DBU -S -u $DBU -x $DAEMON | |
fi | |
} | |
stop() { | |
echo 'Stopping dropbox...' | |
if [ -x $DAEMON ]; then | |
start-stop-daemon -o -c $DBU -K -u $DBU -x $DAEMON | |
fi | |
} | |
status() { | |
dbpid=`pgrep -u $DBU dropbox` | |
if [ -z $dbpid ] ; then | |
echo 'dropboxd for USER '$DBU': not running.' | |
else | |
echo 'dropboxd for USER '$DBU': running (pid '$dbpid')' | |
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