Mohammed Morsi
2009-Jul-15 16:46 UTC
[Ovirt-devel] [PATCH server] convenience init script starting/stopping all ovirt services
installed to /usr/sbin/ovirt_ctl invoke with "sudo ovirt_ctl {start|stop|restart|on|off}" --- ovirt-server.spec.in | 2 + scripts/ovirt_ctl | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 0 deletions(-) create mode 100755 scripts/ovirt_ctl diff --git a/ovirt-server.spec.in b/ovirt-server.spec.in index 1bf73c7..5fda872 100644 --- a/ovirt-server.spec.in +++ b/ovirt-server.spec.in @@ -141,6 +141,7 @@ touch %{buildroot}%{_localstatedir}/log/%{name}/db-omatic.log %{__cp} -a %{pbuild}/scripts/ovirt-vm2node %{buildroot}%{_bindir} %{__cp} -a %{pbuild}/scripts/ovirt-reindex-search %{buildroot}%{_sbindir} %{__cp} -a %{pbuild}/scripts/ovirt-update-search %{buildroot}%{_sbindir} +%{__cp} -a %{pbuild}/scripts/ovirt_ctl %{buildroot}%{_sbindir} %{__rm} -rf %{buildroot}%{app_root}/tmp %{__mkdir} %{buildroot}%{_localstatedir}/lib/%{name}/tmp %{__ln_s} %{_localstatedir}/lib/%{name}/tmp %{buildroot}%{app_root}/tmp @@ -218,6 +219,7 @@ fi %{_sbindir}/ovirt-update-search %{_bindir}/ovirt-add-host %{_bindir}/ovirt-vm2node +%{_bindir}/ovirt_ctl %{_initrddir}/ovirt-host-browser %{_initrddir}/ovirt-host-register %{_initrddir}/ovirt-db-omatic diff --git a/scripts/ovirt_ctl b/scripts/ovirt_ctl new file mode 100755 index 0000000..e9eddde --- /dev/null +++ b/scripts/ovirt_ctl @@ -0,0 +1,66 @@ +#!/bin/bash +# control script for oVirt services, use to start/stop/restart services, and mark as on / off + +. /etc/init.d/functions + +SERVICE_CMD=/sbin/service +CHKCONFIG_CMD=/sbin/chkconfig + +SERVICES=( ovirt-db-omatic ovirt-host-browser \ + ovirt-host-collect ovirt-mongrel-rails \ + ovirt-taskomatic ovirt-vnc-proxy ovirt-agent ) + +RUNLEVELS="2345" + +start() { + for service in ${SERVICES[@]} + do + $SERVICE_CMD $service start + done +} + +stop() { + for service in ${SERVICES[@]} + do + $SERVICE_CMD $service stop + done +} + +set_on(){ + for service in ${SERVICES[@]} + do + $CHKCONFIG_CMD --levels $RUNLEVELS $service on + done +} + +set_off(){ + for service in ${SERVICES[@]} + do + $CHKCONFIG_CMD --levels $RUNLEVELS $service off + done +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + on) + set_on + ;; + off) + set_off + ;; + *) + echo "Usage: ovirt_ctl {start|stop|restart|on|off}" + exit 1 + ;; +esac + +exit $RETVAL -- 1.6.0.6
Jason Guiditta
2009-Jul-27 18:47 UTC
[Ovirt-devel] [PATCH server] convenience init script starting/stopping all ovirt services
On Wed, 2009-07-15 at 12:46 -0400, Mohammed Morsi wrote:> installed to /usr/sbin/ovirt_ctl > invoke with "sudo ovirt_ctl {start|stop|restart|on|off}" > --- > ovirt-server.spec.in | 2 + > scripts/ovirt_ctl | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 68 insertions(+), 0 deletions(-) > create mode 100755 scripts/ovirt_ctl >One change that we discussed in irc, then ACK, works for me> diff --git a/ovirt-server.spec.in b/ovirt-server.spec.in > index 1bf73c7..5fda872 100644 > --- a/ovirt-server.spec.in > +++ b/ovirt-server.spec.in > @@ -141,6 +141,7 @@ touch %{buildroot}%{_localstatedir}/log/%{name}/db-omatic.log > %{__cp} -a %{pbuild}/scripts/ovirt-vm2node %{buildroot}%{_bindir} > %{__cp} -a %{pbuild}/scripts/ovirt-reindex-search %{buildroot}%{_sbindir} > %{__cp} -a %{pbuild}/scripts/ovirt-update-search %{buildroot}%{_sbindir} > +%{__cp} -a %{pbuild}/scripts/ovirt_ctl %{buildroot}%{_sbindir} > %{__rm} -rf %{buildroot}%{app_root}/tmp > %{__mkdir} %{buildroot}%{_localstatedir}/lib/%{name}/tmp > %{__ln_s} %{_localstatedir}/lib/%{name}/tmp %{buildroot}%{app_root}/tmp > @@ -218,6 +219,7 @@ fi > %{_sbindir}/ovirt-update-search > %{_bindir}/ovirt-add-host > %{_bindir}/ovirt-vm2node > +%{_bindir}/ovirt_ctlthis needs to be %{_sbindir} ^^> %{_initrddir}/ovirt-host-browser > %{_initrddir}/ovirt-host-register > %{_initrddir}/ovirt-db-omatic > diff --git a/scripts/ovirt_ctl b/scripts/ovirt_ctl > new file mode 100755 > index 0000000..e9eddde > --- /dev/null > +++ b/scripts/ovirt_ctl > @@ -0,0 +1,66 @@ > +#!/bin/bash > +# control script for oVirt services, use to start/stop/restart services, and mark as on / off > + > +. /etc/init.d/functions > + > +SERVICE_CMD=/sbin/service > +CHKCONFIG_CMD=/sbin/chkconfig > + > +SERVICES=( ovirt-db-omatic ovirt-host-browser \ > + ovirt-host-collect ovirt-mongrel-rails \ > + ovirt-taskomatic ovirt-vnc-proxy ovirt-agent ) > + > +RUNLEVELS="2345" > + > +start() { > + for service in ${SERVICES[@]} > + do > + $SERVICE_CMD $service start > + done > +} > + > +stop() { > + for service in ${SERVICES[@]} > + do > + $SERVICE_CMD $service stop > + done > +} > + > +set_on(){ > + for service in ${SERVICES[@]} > + do > + $CHKCONFIG_CMD --levels $RUNLEVELS $service on > + done > +} > + > +set_off(){ > + for service in ${SERVICES[@]} > + do > + $CHKCONFIG_CMD --levels $RUNLEVELS $service off > + done > +} > + > +case "$1" in > + start) > + start > + ;; > + stop) > + stop > + ;; > + restart) > + stop > + start > + ;; > + on) > + set_on > + ;; > + off) > + set_off > + ;; > + *) > + echo "Usage: ovirt_ctl {start|stop|restart|on|off}" > + exit 1 > + ;; > +esac > + > +exit $RETVAL