-
-
Save lcuevastodoit/903a1774d436b83a790979ecb8bd5278 to your computer and use it in GitHub Desktop.
Stop, Start, Restart Rake tasks for Rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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