Skip to content

Instantly share code, notes, and snippets.

@glava
Last active August 8, 2020 12:34
Show Gist options
  • Save glava/5443766 to your computer and use it in GitHub Desktop.
Save glava/5443766 to your computer and use it in GitHub Desktop.
Stop, Start, Restart Rake tasks for Rails
desc 'Stop rails server'
task :stop do
 File.new("tmp/pids/server.pid").tap { |f| Process.kill 9, f.read.to_i }.delete
end
desc 'Starts rails server'
task :start do
Process.exec("rails s puma -d")
end
desc "Restarts rails server"
task :restart do
Rake::Task[:stop].invoke
Rake::Task[:start].invoke
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment