SHARE
TWEET

Untitled

a guest Aug 12th, 2017 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. # dropbox service
  3. DROPBOX_USERS="user1 user2"
  4.  
  5. DAEMON=.dropbox-dist/dropbox
  6.  
  7. start() {
  8.     echo "Starting dropbox..."
  9.     for dbuser in $DROPBOX_USERS; do
  10.         HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
  11.         if [ -x $HOMEDIR/$DAEMON ]; then
  12.             HOME="$HOMEDIR" start-stop-daemon -b -o -c $dbuser -S -u $dbuser -x $HOMEDIR/$DAEMON
  13.         fi
  14.     done
  15. }
  16.  
  17. stop() {
  18.     echo "Stopping dropbox..."
  19.     for dbuser in $DROPBOX_USERS; do
  20.         HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
  21.         if [ -x $HOMEDIR/$DAEMON ]; then
  22.             start-stop-daemon -o -c $dbuser -K -u $dbuser -x $HOMEDIR/$DAEMON
  23.         fi
  24.     done
  25. }
  26.  
  27. status() {
  28.     for dbuser in $DROPBOX_USERS; do
  29.         dbpid=`pgrep -u $dbuser dropbox`
  30.         if [ -z $dbpid ] ; then
  31.             echo "dropboxd for USER $dbuser: not running."
  32.         else
  33.             echo "dropboxd for USER $dbuser: running (pid $dbpid)"
  34.         fi
  35.     done
  36. }
  37.  
  38. case "$1" in
  39.  
  40.     start)
  41.         start
  42.         ;;
  43.  
  44.     stop)
  45.         stop
  46.         ;;
  47.  
  48.     restart|reload|force-reload)
  49.         stop
  50.         start
  51.         ;;
  52.  
  53.     status)
  54.         status
  55.         ;;
  56.  
  57.     *)
  58.         echo "Usage: /etc/init.d/dropbox {start|stop|reload|force-reload|restart|status}"
  59.         exit 1
  60.  
  61. esac
  62.  
  63. exit 0
RAW Paste Data
Top