tag:blogger.com,1999:blog-11593374.post7987969225860142110..comments2008-02-10T20:02:48.028ZComments on Andrew Beacock's Blog: A Capistrano recipe for restarting Apache 2 (on Li...abeacockhttp://www.blogger.com/profile/01039992884679308726noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-11593374.post-74723114681187790402008-02-10T20:02:00.000Z2008-02-10T20:02:00.000Z2008-02-10T20:02:00.000Zngryman,So what you are saying is if we have a con...ngryman,<BR/><BR/>So what you are saying is if we have a control script that lives within /etc/init.d (and therefore obeys the rules of stop/start/(restart?)) then we can simply list them at the top and get the rest of the rake task to auto-generate the tasks.<BR/><BR/>I like your thinking!abeacockhttp://www.blogger.com/profile/01039992884679308726noreply@blogger.comtag:blogger.com,1999:blog-11593374.post-59968919145664498722008-02-10T19:57:00.000Z2008-02-10T19:57:00.000Z2008-02-10T19:57:00.000ZMore generally, we could use this for a set of sev...More generally, we could use this for a set of several services that we want to control remotly.<BR/>For example with apache and mysql:<BR/><BR/># For each service...<BR/> {:apache => 'apache2', :mysql => 'mysql'}.each do |name, script|<BR/> namespace name do <BR/> # For each action...<BR/> [:stop, :start, :restart, :reload].each do |action|<BR/> desc "#{action.to_s.capitalize} #{name.to_s.capitalize}"<BR/> task action, :roles => :web do<BR/> run "/etc/init.d/#{script} #{action.to_s}"<BR/> end<BR/> end<BR/> end<BR/> endngrymanhttp://www.peon-factory.comnoreply@blogger.comtag:blogger.com,1999:blog-11593374.post-80056935392846374222008-02-10T19:39:00.000Z2008-02-10T19:39:00.000Z2008-02-10T19:39:00.000ZThanks!Very elegant way to do :)Thanks!<BR/>Very elegant way to do :)ngrymannoreply@blogger.com