Advertisement
Guest User

Untitled

a guest
Oct 14th, 2011
544
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. # chkconfig: 345 85 15
  2. # description: Startup script for dropbox daemon
  3. #
  4. # processname: dropboxd
  5. # pidfile: /var/run/dropbox.pid
  6. # config: /etc/sysconfig/dropbox
  7. #
  8.  
  9. ### BEGIN INIT INFO
  10. # Provides: dropboxd
  11. # Required-Start: $local_fs $network $syslog
  12. # Required-Stop: $local_fs $syslog
  13. # Should-Start: $syslog
  14. # Should-Stop: $network $syslog
  15. # Default-Start: 2 3 4 5
  16. # Default-Stop: 0 1 6
  17. # Short-Description: Start up the Dropbox file syncing daemon
  18. # Description: Dropbox is a filesyncing sevice provided by dropbox.com
  19. # This service starts up the dropbox daemon.
  20. ### END INIT INFO
  21.  
  22. # Source function library.
  23. . /etc/rc.d/init.d/functions
  24.  
  25. # To configure, add line with DROPBOX_USERS="user1 user2" to /etc/sysconfig/dropbox
  26. # Probably should use a dropbox group in /etc/groups instead.
  27.  
  28. [ -f /etc/sysconfig/dropbox ] && . /etc/sysconfig/dropbox
  29. prog=dropboxd
  30. lockfile=${LOCKFILE-/var/lock/subsys/$prog}
  31. config=${CONFIG-/etc/sysconfig/dropbox}
  32. RETVAL=0
  33.  
  34. start() {
  35. echo -n $"Starting $prog"
  36. if [ -z $DROPBOX_USERS ] ; then
  37. echo -n ": unconfigured: $config"
  38. echo_failure
  39. echo
  40. rm -f ${lockfile} ${pidfile}
  41. RETURN=6
  42. return $RETVAL
  43. fi
  44. for dbuser in $DROPBOX_USERS; do
  45. daemon --user $dbuser /bin/sh -c "~$dbuser/.dropbox-dist/dropboxd&"
  46. done
  47. RETVAL=$?
  48. echo
  49. [ $RETVAL = 0 ] && touch ${lockfile}
  50. return $RETVAL
  51. }
  52.  
  53. status() {
  54. for dbuser in $DROPBOX_USERS; do
  55. dbpid=`pgrep -u $dbuser dropbox | grep -v grep`
  56. if [ -z $dbpid ] ; then
  57. echo "dropboxd for USER $dbuser: not running."
  58. else
  59. echo "dropboxd for USER $dbuser: running (pid $dbpid)"
  60. fi
  61. done
  62. }
  63.  
  64. stop() {
  65. echo -n $"Stopping $prog"
  66. for dbuser in $DROPBOX_USERS; do
  67. killproc ~$dbuser/.dropbox-dist/dropbox
  68. done
  69. RETVAL=$?
  70. echo
  71. [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
  72. }
  73.  
  74. # See how we were called.
  75. case "$1" in
  76. start)
  77. start
  78. ;;
  79. status)
  80. status
  81. ;;
  82. stop)
  83. stop
  84. ;;
  85. restart)
  86. stop
  87. start
  88. ;;
  89. *)
  90. echo $"Usage: $prog {start|status|stop|restart}"
  91. RETVAL=3
  92. esac
  93. exit $RETVAL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement