summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Lowell <glowell@inktank.com>2013-02-19 17:25:27 -0800
committerGary Lowell <glowell@inktank.com>2013-04-11 23:00:05 -0700
commit61a900788b627eac9349ec337e210a130916706d (patch)
tree98813e97da57ddbbcfbe31ff0172257e4a982df2
parent87ff4af1d17ba0d13e508087026f27711cb8de41 (diff)
downloadceph-wip-init-radosgw.tar.gz
init-radosgw.sysv: New radosgw init file for rpm based systemswip-init-radosgw
Added init-radosgw.sys file for rpm based systems, added it to the tarball list in the makefile, and updated the specfile to install it. Also added the a dependency in ceph since it uses utility routes from that package (On debian systems these are packaged in ceph-common). Incorporated review comments from Alex. (Bug #4571) Signed-off-by: Gary Lowell <gary.lowell@inktank.com> Reviewed-by: Alexandre Marangone <alexandre.marangone@inktank.com>
-rw-r--r--ceph.spec.in8
-rw-r--r--src/Makefile.am1
-rw-r--r--src/init-radosgw.sysv91
3 files changed, 96 insertions, 4 deletions
diff --git a/ceph.spec.in b/ceph.spec.in
index fc4d5466db7..1e5d7f5b818 100644
--- a/ceph.spec.in
+++ b/ceph.spec.in
@@ -289,10 +289,10 @@ make DESTDIR=$RPM_BUILD_ROOT install
find $RPM_BUILD_ROOT -type f -name "*.la" -exec rm -f {} ';'
find $RPM_BUILD_ROOT -type f -name "*.a" -exec rm -f {} ';'
install -D src/init-ceph $RPM_BUILD_ROOT%{_initrddir}/ceph
-install -D src/init-radosgw $RPM_BUILD_ROOT%{_initrddir}/ceph-radosgw
-mkdir -p $RPM_BUILD_ROOT%{_sbindir}
-ln -sf ../../etc/init.d/ceph %{buildroot}/%{_sbindir}/rcceph
-ln -sf ../../etc/init.d/ceph-radosgw %{buildroot}/%{_sbindir}/rcceph-radosgw
+install -D src/init-radosgw.sysv $RPM_BUILD_ROOT%{_initrddir}/ceph-radosgw
+mkdir -p $RPM_BUILD_ROOT/usr/sbin
+ln -sf ../../etc/init.d/ceph %{buildroot}/usr/sbin/rcceph
+ln -sf ../../etc/init.d/ceph-radosgw %{buildroot}/usr/sbin/rcceph-radosgw
install -m 0644 -D src/logrotate.conf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/ceph
install -m 0644 -D src/rgw/logrotate.conf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/radosgw
chmod 0644 $RPM_BUILD_ROOT%{_docdir}/ceph/sample.ceph.conf
diff --git a/src/Makefile.am b/src/Makefile.am
index 5fe7da683eb..d528b78a1be 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1168,6 +1168,7 @@ EXTRA_DIST += \
$(srcdir)/verify-mds-journal.sh $(srcdir)/vstart.sh $(srcdir)/stop.sh \
ceph-run $(srcdir)/ceph_common.sh \
$(srcdir)/init-radosgw \
+ $(srcdir)/init-radosgw.sysv \
$(srcdir)/ceph-clsinfo $(srcdir)/make_version $(srcdir)/check_version \
$(srcdir)/.git_version \
$(srcdir)/ceph-rbdnamer \
diff --git a/src/init-radosgw.sysv b/src/init-radosgw.sysv
new file mode 100644
index 00000000000..48a7b5b8f96
--- /dev/null
+++ b/src/init-radosgw.sysv
@@ -0,0 +1,91 @@
+#! /bin/bash -x
+### BEGIN INIT INFO
+# Provides: radosgw
+# Required-Start: $remote_fs $named $network $time
+# Required-Stop: $remote_fs $named $network $time
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: radosgw RESTful rados gateway
+### END INIT INFO
+
+PATH=/sbin:/bin:/usr/bin
+
+#. /lib/lsb/init-functions
+. /etc/rc.d/init.d/functions
+
+# prefix for radosgw instances in ceph.conf
+PREFIX='client.radosgw.'
+
+# user to run radosgw as (it not specified in ceph.conf)
+#DEFAULT_USER='www-data'
+DEFAULT_USER='apache'
+
+# directory to write logs to
+LOGDIR='/var/log/radosgw'
+
+RADOSGW=`which radosgw`
+if [ ! -x "$RADOSGW" ]; then
+ exit 0
+fi
+
+# make sure log dir exists
+if [ ! -d "$LOGDIR" ]; then
+ mkdir -p $LOGDIR
+fi
+
+case "$1" in
+ start)
+ for name in `ceph-conf --list-sections $PREFIX`;
+ do
+ auto_start=`ceph-conf -n $name 'auto start'`
+ if [ "$auto_start" = "no" ] || [ "$auto_start" = "false" ] || [ "$auto_start" = "0" ]; then
+ continue
+ fi
+
+ # is the socket defined? if it's not, this instance shouldn't run as a daemon.
+ rgw_socket=`ceph-conf -n $name 'rgw socket path'`
+ if [ -z "$rgw_socket" ]; then
+ continue
+ fi
+
+ # mapped to this host?
+ host=`ceph-conf -n $name host`
+ if [ "$host" != `hostname` ]; then
+ continue
+ fi
+
+ user=`ceph-conf -n $name user`
+ if [ -z "$user" ]; then
+ user="$DEFAULT_USER"
+ fi
+
+ log_file=`ceph-conf -n $name log_file`
+ if [ -n "$log_file" ] && [ ! -e "$log_file" ]; then
+ touch "$log_file"
+ chown $user $log_file
+ fi
+
+ #start-stop-daemon --start -u $user -x $RADOSGW -- -n $name
+ daemon --user="$user" "$RADOSGW -n $name"
+ echo "Starting $name..."
+ done
+ ;;
+ reload)
+ #start-stop-daemon --signal HUP -x $RADOSGW --oknodo
+ killproc $RADOSGW -SIGHUP
+ echo "Reloading radosgw..."
+ ;;
+ restart|force-reload)
+ $0 stop
+ $0 start
+ ;;
+ stop)
+ #start-stop-daemon --stop -x $RADOSGW --oknodo
+ killproc $RADOSGW
+ echo "Stopping radosgw..."
+ ;;
+ *)
+ echo "Usage: $0 start|stop|restart" >&2
+ exit 3
+ ;;
+esac \ No newline at end of file