Is it possible to trigger a service restart without always forcing that service to be running? We shutdown mysql for about 30min every day to do backups, and I don''t want puppet to start mysql during this window. So I''ve removed ensure => "running" from the mysql service. But now notify => Service[mysql] doesn''t restart mysql. Is it possible to tell puppet to ensure => "running" on mysql except for the 30min scheduled outage? Or, is there another way to trigger a service restart when the config file changes? My last resort is to shutdown puppetd during the 30min window, but this seems ugly. Dane -- Dane Miller Systems Administrator Great Schools, Inc http://greatschools.net
2007/8/8, Dane Miller <dane@greatschools.net>:> Is it possible to trigger a service restart without always forcing that > service to be running? We shutdown mysql for about 30min every day to > do backups, and I don''t want puppet to start mysql during this window. > > So I''ve removed ensure => "running" from the mysql service. But now > notify => Service[mysql] doesn''t restart mysql. > > Is it possible to tell puppet to ensure => "running" on mysql except for > the 30min scheduled outage? > > Or, is there another way to trigger a service restart when the config > file changes? > > My last resort is to shutdown puppetd during the 30min window, but this > seems ugly.Maybe scheduling is what you are looking for: http://reductivelabs.com/trac/puppet/wiki/TypeReference#id41> Dane > -- > Dane Miller > Systems Administrator > Great Schools, Inc > http://greatschools.net > > _______________________________________________ > Puppet-users mailing list > Puppet-users@madstop.com > https://mail.madstop.com/mailman/listinfo/puppet-users >-- Andreas
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wednesday 08 August 2007, Dane Miller wrote:> Is it possible to trigger a service restart without always forcing that > service to be running? We shutdown mysql for about 30min every day to > do backups, and I don''t want puppet to start mysql during this window. > > So I''ve removed ensure => "running" from the mysql service. But now > notify => Service[mysql] doesn''t restart mysql. > > Is it possible to tell puppet to ensure => "running" on mysql except for > the 30min scheduled outage? > > Or, is there another way to trigger a service restart when the config > file changes? > > My last resort is to shutdown puppetd during the 30min window, but this > seems ugly.Use a custom fact to decide whether mysqld should be running or not. This way you reduce the window for race conditions down to the length of a puppet run[1]. This could be mitigated by using "puppetd --tag something" to stop/start mysqld (decided by the custom fact), because that would take the puppetlock. Regards, David [1] Where puppet would think the mysql should be stopped, but you really are starting it again. - -- The primary freedom of open source is not the freedom from cost, but the free- dom to shape software to do what you want. This freedom is /never/ exercised without cost, but is available /at all/ only by accepting the very different costs associated with open source, costs not in money, but in time and effort. - -- http://www.schierer.org/~luke/log/20070710-1129/on-forks-and-forking -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFGuiPT/Pp1N6Uzh0URAtdoAJ9/rsTy7EKOLyJfKLU2h3InrfmFywCfaCrP tQ4cgIrU0SGtMHR5WpTCztY=PkBK -----END PGP SIGNATURE-----
On 8/8/2007 2:39 PM, Dane Miller wrote:> Is it possible to trigger a service restart without always forcing > that service to be running? We shutdown mysql for about 30min every > day to do backups, and I don''t want puppet to start mysql during this > window.Creative use of schedule [1]? Untested, but should be close, and could probably be improved: schedule { "premaintenance": range => "0:00 - 1:00", period => daily; } schedule { "postmaintenance": range => "1:30 - 23:59", period => daily; } service { [ "mysql" ]: pattern => "/usr/sbin/mysqld", ensure => running, schedule => [ premaintenance, postmaintenance ], subscribe => [ File["/etc/my.conf"] ]; } [1] http://reductivelabs.com/trac/puppet/wiki/TypeReference#id41 -- Mike Renfro / R&D Engineer, Center for Manufacturing Research, 931 372-3601 / Tennessee Technological University -- renfro@tntech.edu
On Wed, 2007-08-08 at 17:42 -0500, Mike Renfro wrote:> Creative use of schedule [1]? Untested, but should be close, and could > probably be improved:Using ''schedule'' didn''t work for me. I tested by manually stopping mysql to see if puppet would restart it, but puppet did nothing. I wonder if schedule''s "repeat" attribute is getting in the way: node db { include mysql } class mysql { schedule { "online": range => "0 - 22:34", period => daily,} service { mysqld: name => "mysql-server", pattern => "mysqld", schedule => online, ensure => running, } } Dane -- Dane Miller Systems Administrator Great Schools, Inc http://greatschools.net
On Aug 8, 2007, at 3:39 PM, Dane Miller wrote:> Is it possible to trigger a service restart without always forcing > that > service to be running? We shutdown mysql for about 30min every day to > do backups, and I don''t want puppet to start mysql during this window.I think you could consider the current system a bug. What I currently do is check to see if the service should be running, but what it should do instead is just check if it is running. Can you file that? -- The difference between scientists and engineers is that when engineers screw up, people die. -- Professor Orthlieb --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
On Fri, 2007-08-10 at 11:38 -0400, Luke Kanies wrote:> I think you could consider the current system a bug. > > What I currently do is check to see if the service should be running, > but what it should do instead is just check if it is running. > > Can you file that?Filed as Ticket #766. Dane
On Wed, 2007-08-08 at 22:13 +0200, David Schmitt wrote:> On Wednesday 08 August 2007, Dane Miller wrote: > > Is it possible to trigger a service restart without always forcing that > > service to be running? We shutdown mysql for about 30min every day to > > do backups, and I don''t want puppet to start mysql during this window. > > Use a custom fact to decide whether mysqld should be running or not. This way > you reduce the window for race conditions down to the length of a puppet > run[1]. This could be mitigated by using "puppetd --tag something" to > stop/start mysqld (decided by the custom fact), because that would take the > puppetlock.Thanks David, this is what I ended up doing. My backup script stops mysqld and creates a lock file, which my custom facter script looks for, which sets the fact "backup_running", which my manifest looks for... yikes! It''s a bit convoluted, but it works for now: service { "mysqld": ensure => $backup_running ? { "true" => stopped, default => running, } } -- Dane Miller Systems Administrator Great Schools, Inc http://greatschools.net