-
-
Save nebirhos/3832197 to your computer and use it in GitHub Desktop.
/etc/init.d/dropbox
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 | |
### 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 | |
### END INIT INFO | |
DROPBOX_USERS="user1 user2" | |
start() { | |
echo "Starting dropbox..." | |
for dbuser in $DROPBOX_USERS; do | |
if [ $dbuser = "root" ]; then | |
path=/root | |
else | |
path=/home/$dbuser | |
fi | |
start-stop-daemon -b -o -c $dbuser -S -x $path/.dropbox-dist/dropboxd | |
done | |
} | |
stop() { | |
echo "Stopping dropbox..." | |
for dbuser in $DROPBOX_USERS; do | |
if [ $dbuser = "root" ]; then | |
path=/root | |
else | |
path=/home/$dbuser | |
fi | |
start-stop-daemon -o -c $dbuser -K -x $path/.dropbox-dist/dropboxd | |
done | |
} | |
status() { | |
for dbuser in $DROPBOX_USERS; do | |
dbpid=`pgrep -u $dbuser dropbox` | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment