Advertisement
Guest User

Untitled

a guest
Jan 29th, 2013
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides: radosgw
  4. # Required-Start: $remote_fs $named $network $time
  5. # Required-Stop: $remote_fs $named $network $time
  6. # Default-Start: 2 3 4 5
  7. # Default-Stop: 0 1 6
  8. # Short-Description: radosgw RESTful rados gateway
  9. ### END INIT INFO
  10.  
  11. PATH=/sbin:/bin:/usr/bin
  12.  
  13. . /lib/lsb/init-functions
  14.  
  15. # prefix for radosgw instances in ceph.conf
  16. PREFIX='client.radosgw.'
  17.  
  18. # user to run radosgw as (it not specified in ceph.conf)
  19. DEFAULT_USER='www-data'
  20.  
  21. # directory to write logs to
  22. LOGDIR='/var/log/radosgw'
  23.  
  24. RADOSGW=`which radosgw`
  25. if [ ! -x "$RADOSGW" ]; then
  26. exit 0
  27. fi
  28.  
  29. # make sure log dir exists
  30. if [ ! -d "$LOGDIR" ]; then
  31. mkdir -p $LOGDIR
  32. fi
  33.  
  34. case "$1" in
  35. start)
  36. for name in `ceph-conf --list-sections $PREFIX`;
  37. do
  38. auto_start=`ceph-conf -n $name 'auto start'`
  39. if [ "$auto_start" = "no" ] || [ "$auto_start" = "false" ] || [ "$auto_start" = "0" ]; then
  40. continue
  41. fi
  42.  
  43. # is the socket defined? if it's not, this instance shouldn't run as a daemon.
  44. rgw_socket=`ceph-conf -n $name 'rgw socket path'`
  45. if [ -z "$rgw_socket" ]; then
  46. continue
  47. fi
  48.  
  49. # mapped to this host?
  50. host=`ceph-conf -n $name host`
  51. if [ "$host" != `hostname` ]; then
  52. continue
  53. fi
  54.  
  55. user=`ceph-conf -n $name user`
  56. if [ -z "$user" ]; then
  57. user="$DEFAULT_USER"
  58. fi
  59.  
  60. log_file=`ceph-conf -n $name log_file`
  61. if [ -n "$log_file" ] && [ ! -e "$log_file" ]; then
  62. touch "$log_file"
  63. chown $user $log_file
  64. fi
  65.  
  66. echo "Starting $name..."
  67. start-stop-daemon --start -u $user -x $RADOSGW -- -n $name
  68. done
  69. ;;
  70. reload)
  71. echo "Reloading $name..."
  72. start-stop-daemon --signal HUP -x $RADOSGW --oknodo
  73. ;;
  74. restart|force-reload)
  75. $0 stop
  76. $0 start
  77. ;;
  78. stop)
  79. start-stop-daemon --stop -x $RADOSGW --oknodo
  80. ;;
  81. *)
  82. echo "Usage: $0 start|stop|restart" >&2
  83. exit 3
  84. ;;
  85. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement