From: Maros Zatko mzatko@redhat.com
--- bin/aeolus-restart-services | 48 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 48 insertions(+), 0 deletions(-) create mode 100755 bin/aeolus-restart-services
diff --git a/bin/aeolus-restart-services b/bin/aeolus-restart-services new file mode 100755 index 0000000..5e9eb73 --- /dev/null +++ b/bin/aeolus-restart-services @@ -0,0 +1,48 @@ +#!/usr/bin/ruby + +# ordered as in rc.d +services = %w(mongod messagebus iwhd postgresql httpd qpidd deltacloud-ec2-us-east-1 deltacloud-ec2-us-west-1 deltacloud-mock libvirtd condor aeolus-conductor conductor-dbomatic imagefactory) + +def perform(action, svcs) + action = action.to_s + svcs.map do |script| + puts "\n#{action.capitalize}ing #{script} ..." + cmd = "/etc/init.d/#{script} #{action}" + out = `#{cmd}` + if $?.to_i == 0 + puts " \e[1;32mSuccess:\e[0m #{out.strip}" + else + puts " \e[1;31mFAILURE:\e[0m #{out.strip}" + end + $?.to_i + end +end + +perform :stop, services.reverse +perform :start, services + +## Other checks +commands = [ + {:name => 'condor_q', :command => 'condor_q'}, + {:name => 'condor_status', :command => 'condor_status'} +] +commands.each do |cmd| + puts "\nChecking #{cmd[:name]} ..." + cmd = "#{cmd[:command]}" + out = `#{cmd}` + if $?.to_i == 0 + puts " \e[1;32mSuccess:\e[0m #{out.strip}" + else + puts " \e[1;31mFAILURE:\e[0m #{out.strip}" + end +end + +if perform(:status, ['mongod']) == [1] + lockfile = '/var/lib/mongodb/mongod.lock' + if File.exists?(lockfile) + puts " \e[1;33mremoving\e[0m leftover #{lockfile}" + File.delete(lockfile) + perform :restart, %w(mongod iwhd) + end +end +
From: Maros Zatko mzatko@redhat.com
--- contrib/aeolus-configure.spec | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/contrib/aeolus-configure.spec b/contrib/aeolus-configure.spec index b8f7252..3c6c999 100644 --- a/contrib/aeolus-configure.spec +++ b/contrib/aeolus-configure.spec @@ -4,7 +4,7 @@ Summary: Aeolus Configure Puppet Recipe Name: aeolus-configure Version: 2.0.2 -Release: 2%{?extra_release}%{?dist} +Release: 3%{?extra_release}%{?dist}
Group: Applications/Internet License: GPLv2+ @@ -45,6 +45,7 @@ Aeolus Configure Puppet Recipe %{__cp} -R %{pbuild}/recipes/openssl/ %{buildroot}/%{aeolushome}/modules/openssl %{__cp} -R %{pbuild}/recipes/postgres/ %{buildroot}/%{aeolushome}/modules/postgres %{__cp} -R %{pbuild}/bin/aeolus-check-services %{buildroot}/%{_bindir}/ +%{__cp} -R %{pbuild}/bin/aeolus-restart-services %{buildroot}/%{_bindir}/ %{__cp} -R %{pbuild}/bin/aeolus-configure-image %{buildroot}/%{_sbindir}/ %{__cp} -R %{pbuild}/bin/aeolus-configure %{buildroot}/%{_sbindir}/ %{__cp} -R %{pbuild}/bin/aeolus-cleanup %{buildroot}/%{_sbindir}/ @@ -56,10 +57,14 @@ Aeolus Configure Puppet Recipe %attr(0755, root, root) %{_sbindir}/aeolus-node %config(noreplace) %{_sysconfdir}/aeolus-configure/* %attr(0755, root, root) %{_bindir}/aeolus-check-services +%attr(0755, root, root) %{_bindir}/aeolus-restart-services %{aeolushome} %{_sbindir}/aeolus-configure-image
%changelog +* Tue Aug 30 2011 Maros Zatko mzatko@redhat.com 2.0.2-3 +- Added script for restarting running services + * Tue Aug 16 2011 Maros Zatko mzatko@redhat.com 2.0.2-2 - Added script for listing running services
ACK to both, with a couple of comments:
* could you replace the tabs w/ 2 spaces each
* this script should go in sbin as it needs to be run by the sysadmin
Other than that looks good and works, feel free to push away after those changes.
As a side note, I'm starting to think that we will want to write a high level 'aeolus' init script through which to wrap all our services through the sysvinit / systemd interface. Something like how the 'condor' init script wraps all the condor services (eg the scheduler, gridmanager, collector, etc). These scripts will suffice for the time being though, good work.
-Mo
On 08/30/2011 10:15 AM, mzatko@redhat.com wrote:
From: Maros Zatkomzatko@redhat.com
bin/aeolus-restart-services | 48 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 48 insertions(+), 0 deletions(-) create mode 100755 bin/aeolus-restart-services
diff --git a/bin/aeolus-restart-services b/bin/aeolus-restart-services new file mode 100755 index 0000000..5e9eb73 --- /dev/null +++ b/bin/aeolus-restart-services @@ -0,0 +1,48 @@ +#!/usr/bin/ruby
+# ordered as in rc.d +services = %w(mongod messagebus iwhd postgresql httpd qpidd deltacloud-ec2-us-east-1 deltacloud-ec2-us-west-1 deltacloud-mock libvirtd condor aeolus-conductor conductor-dbomatic imagefactory)
+def perform(action, svcs)
- action = action.to_s
- svcs.map do |script|
puts "\n#{action.capitalize}ing #{script} ..."
cmd = "/etc/init.d/#{script} #{action}"
out = `#{cmd}`
if $?.to_i == 0
puts " \e[1;32mSuccess:\e[0m #{out.strip}"
else
puts " \e[1;31mFAILURE:\e[0m #{out.strip}"
end
$?.to_i
- end
+end
+perform :stop, services.reverse +perform :start, services
+## Other checks +commands = [
- {:name => 'condor_q', :command => 'condor_q'},
- {:name => 'condor_status', :command => 'condor_status'}
+] +commands.each do |cmd|
- puts "\nChecking #{cmd[:name]} ..."
- cmd = "#{cmd[:command]}"
- out = `#{cmd}`
if $?.to_i == 0
puts " \e[1;32mSuccess:\e[0m #{out.strip}"
else
puts " \e[1;31mFAILURE:\e[0m #{out.strip}"
end
+end
+if perform(:status, ['mongod']) == [1]
- lockfile = '/var/lib/mongodb/mongod.lock'
- if File.exists?(lockfile)
puts " \e[1;33mremoving\e[0m leftover #{lockfile}"
File.delete(lockfile)
perform :restart, %w(mongod iwhd)
- end
+end
On 09/09/2011 01:11 AM, Mo Morsi wrote:
ACK to both, with a couple of comments:
could you replace the tabs w/ 2 spaces each
this script should go in sbin as it needs to be run by the sysadmin
Other than that looks good and works, feel free to push away after those changes.
As a side note, I'm starting to think that we will want to write a high level 'aeolus' init script through which to wrap all our services through the sysvinit / systemd interface. Something like how the 'condor' init script wraps all the condor services (eg the scheduler, gridmanager, collector, etc). These scripts will suffice for the time being though, good work.
-Mo
Mo,
That seems like a good idea, but I"m struggling with how to right up the feature request. Would you mind putting together your thoughts and making it land in redmine?
Thanks, Mike
<snip>
On 09/09/2011 05:19 PM, Mike Orazi wrote:
On 09/09/2011 01:11 AM, Mo Morsi wrote:
ACK to both, with a couple of comments:
could you replace the tabs w/ 2 spaces each
this script should go in sbin as it needs to be run by the sysadmin
Other than that looks good and works, feel free to push away after those changes.
As a side note, I'm starting to think that we will want to write a high level 'aeolus' init script through which to wrap all our services through the sysvinit / systemd interface. Something like how the 'condor' init script wraps all the condor services (eg the scheduler, gridmanager, collector, etc). These scripts will suffice for the time being though, good work.
-Mo
Mo,
That seems like a good idea, but I"m struggling with how to right up the feature request. Would you mind putting together your thoughts and making it land in redmine?
Thanks, Mike
<snip> _______________________________________________ aeolus-devel mailing list aeolus-devel@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/aeolus-devel
Sure thing, here ya go:
https://www.aeolusproject.org/redmine/issues/2261
-Mo
aeolus-devel@lists.fedorahosted.org