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
. /lib/lsb/init-functions
18
if pidof $daemon >/dev/null; then
19
echo "$daemon is running."
22
echo "$daemon is not running."
29
if [ "$opt" = "-v" ] || [ "$opt" = "--verbose" ]; then
34
# prefix for radosgw instances in ceph.conf
35
PREFIX='client.radosgw.'
37
# user to run radosgw as (it not specified in ceph.conf)
38
DEFAULT_USER='www-data'
40
RADOSGW=`which radosgw`
41
if [ ! -x "$RADOSGW" ]; then
42
[ $VERBOSE -eq 1 ] && echo "$RADOSGW could not start, it is not executable."
48
for name in `ceph-conf --list-sections $PREFIX`;
50
auto_start=`ceph-conf -n $name 'auto start'`
51
if [ "$auto_start" = "no" ] || [ "$auto_start" = "false" ] || [ "$auto_start" = "0" ]; then
55
# is the socket defined? if it's not, this instance shouldn't run as a daemon.
56
rgw_socket=`$RADOSGW -n $name --show-config-value rgw_socket_path`
57
if [ -z "$rgw_socket" ]; then
61
# mapped to this host?
62
host=`ceph-conf -n $name host`
63
hostname=`hostname -s`
64
if [ "$host" != "$hostname" ]; then
65
[ $VERBOSE -eq 1 ] && echo "hostname $hostname could not be found in ceph.conf:[$name], not starting."
69
user=`ceph-conf -n $name user`
70
if [ -z "$user" ]; then
74
log_file=`$RADOSGW -n $name --show-config-value log_file`
75
if [ -n "$log_file" ] && [ ! -e "$log_file" ]; then
80
echo "Starting $name..."
81
start-stop-daemon --start -u $user -x $RADOSGW -- -n $name
83
daemon_is_running $RADOSGW
86
echo "Reloading $name..."
87
start-stop-daemon --stop --signal HUP -x $RADOSGW --oknodo
94
start-stop-daemon --stop -x $RADOSGW --oknodo
97
daemon_is_running $RADOSGW
100
echo "Usage: $0 {start|stop|restart|force-reload|reload|status} [-v|--verbose]" >&2