4 # Required-Start: $remote_fs $named $network $time
5 # Required-Stop: $remote_fs $named $network $time
6 # Default-Start: 2 3 4 5
8 # Short-Description: radosgw RESTful rados gateway
9 # Description: radosgw RESTful rados gateway
12 PATH=/sbin:/bin:/usr/bin
14 if [ -x /sbin/start-stop-daemon ]; then
16 . /lib/lsb/init-functions
18 . /etc/rc.d/init.d/functions
24 if pidof $daemon >/dev/null; then
25 echo "$daemon is running."
28 echo "$daemon is not running."
35 if [ "$opt" = "-v" ] || [ "$opt" = "--verbose" ]; then
40 # prefix for radosgw instances in ceph.conf
41 PREFIX='client.radosgw.'
43 # user to run radosgw as (if not specified in ceph.conf)
46 RADOSGW=`which radosgw`
47 if [ ! -x "$RADOSGW" ]; then
48 [ $VERBOSE -eq 1 ] && echo "$RADOSGW could not start, it is not executable."
52 # list daemons, old-style and new-style
53 # NOTE: no support for cluster names that aren't "ceph"
54 dlist=`ceph-conf --list-sections $PREFIX`
55 if [ -d "/var/lib/ceph/radosgw" ]; then
56 for d in `ls /var/lib/ceph/radosgw | grep ^ceph-`; do
57 if [ -e "/var/lib/ceph/radosgw/$d/sysvinit" ]; then
58 id=`echo $d | cut -c 6-`
59 dlist="client.$id $dlist"
68 auto_start=`ceph-conf -n $name 'auto start'`
69 if [ "$auto_start" = "no" ] || [ "$auto_start" = "false" ] || [ "$auto_start" = "0" ]; then
73 shortname=`echo $name | cut -c 8-`
74 if [ ! -e "/var/lib/ceph/radosgw/ceph-$shortname/sysvinit" ]; then
75 # mapped to this host?
76 host=`ceph-conf -n $name host`
77 hostname=`hostname -s`
78 if [ "$host" != "$hostname" ]; then
79 [ $VERBOSE -eq 1 ] && echo "hostname $hostname could not be found in ceph.conf:[$name], not starting."
84 user=`ceph-conf -n $name user`
85 if [ -z "$user" ]; then
89 log_file=`$RADOSGW -n $name --show-config-value log_file`
90 if [ -n "$log_file" ]; then
91 if [ ! -e "$log_file" ]; then
97 echo "Starting $name..."
98 if [ $DEBIAN -eq 1 ]; then
99 start-stop-daemon --start -u $user -x $RADOSGW -p /var/run/ceph/client-$name.pid -- -n $name
102 core_limit=`ceph-conf -n $name 'core file limit'`
103 if [ -z $core_limit ]; then
104 DAEMON_COREFILE_LIMIT=$core_limit
106 daemon --user="$user" "$RADOSGW -n $name"
111 echo "Reloading $name..."
112 if [ $DEBIAN -eq 1 ]; then
113 start-stop-daemon --stop --signal HUP -x $RADOSGW --oknodo
115 killproc $RADOSGW -HUP
118 restart|force-reload)
126 t=`$RADOSGW -n $name --show-config-value rgw_exit_timeout_secs`
127 if [ $t -gt $timeout ]; then timeout=$t; fi
130 if [ $DEBIAN -eq 1 ]; then
131 if [ $timeout -gt 0 ]; then TIMEOUT="-R $timeout"; fi
132 start-stop-daemon --stop -x $RADOSGW --oknodo $TIMEOUT
135 while pidof $RADOSGW >/dev/null && [ $timeout -gt 0 ] ; do
137 timeout=$(($timeout - 1))
142 daemon_is_running $RADOSGW
145 echo "Usage: $0 {start|stop|restart|force-reload|reload|status} [-v|--verbose]" >&2