Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ahadshafiq/5302058 to your computer and use it in GitHub Desktop.
Save ahadshafiq/5302058 to your computer and use it in GitHub Desktop.
Rails daemon
Instead of
rails server
do:
rails s -d
then to kill it, find which process is using the port:
lsof -i :3000
finally, kill the process:
kill -9 $(lsof -i :3000 -t)
Create aliases:
alias startRails='rails server -d'
alias stopRails='kill -9 $(lsof -i :3000 -t)'
** extra
Find what processes are running:
ps aux|grep nameofprogram
** run any process as a background job by postfixing the execution command with &
user 'jobs' to see whats running in the background
then to bring into foreground: fg %1
** some jobs output completion status to screen. Clockwork will be very inteerruptive.
To print those putputs to a file instead of the screen:
bundle exec clockwork config/clock.rb 2>&1 >>/var/www/applicationname/log/clockwork-output-log &
2>&1 >>/pathtologfile &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment