Start rails server automatically when ever I start my ubuntu machine
You can use a cron job for this. To add the cron job use the command crontab -e
. Than you can define a cron job that runs at boot and reboot with @reboot command
.
So you'd have something like:
@reboot cd /home/[path to project] && rails server
start thinking sphinx on rails server startup
There's two options I can think of.
- You could look at how Ubuntu manages start-up scripts and add one for this (perhaps in
/etc/init
?). - You could set up monit or another monitoring tool and have it keep Sphinx running. Monit should boot automatically when your server restarts, and so it should ensure Sphinx (and anything else it's tracking) is running.
The catch with Monit and other such tools is that when you deliberately stop Sphinx (say, to update configuration structure and corresponding index changes), it might start it up again before it's appropriate. So I think you should start with the first of these two options - I just don't know a great deal about the finer points of that approach.
start unicorn app server when the ubuntu server starts
In my case, I just wanted it quick so I place the startup command in /etc/rc.local
like below. Note that i'm using RVM
.
# By default this script does nothing.
cd <your project dir>
/usr/local/rvm/gems/ruby-2.2.1/wrappers/bundle exec unicorn -c <your project dir>/config/unicorn.conf -D
test -e /etc/ssh/ssh_host_dsa_key || dpkg-reconfigure openssh-server
exit 0
Make sure your startup command is above the exit 0. After you reboot, check whether it is running or not by directly hitting the url of your application or use ps -aux | grep unicorn
command.
Note* Previously I use Phusion Passenger but I'm having trouble to see its error log, so I move back to unicorn. I also tried @warantesbr without success, which I guess it fails because my whole environment where setup using root access.
Starting Resque at boot / Passenger restart
What about using foreman for this issue?
Foreman is a procfile-based tool to manage multi-process rails apps.
A simple intro can be seen at railscasts. An example may look like this:
web: bundle exec rails server
solr: bundle exec rake sunspot:solr:run
resque: rake RAILS_ENV=production environment resque:work QUEUE='*'
Related Topics
Insert Linux Kernel Module Statically
Using a User's .Bashrc in a Systemd Service
Remove ^H and ^M Characters from a File Using Linux Shell Scripting
What Does "< /Dev/Null >& /Dev/Null" at the End of a Command Do
How to Load a Specific Version of R in Linux
What Is the Best Tool to Convert Common Video Formats to Flv on a Linux Cli
Will Ctrl+C Send Sigint Signals to Both Parent and Child Processes in Linux
How to Check Whether the Processor Cache Has Been Flushed Recently
How to Use Aio and Epoll Together in a Single Event Loop
What Is Chained Irq in Linux, When Are They Need to Used
Switch from 32Bit Mode to 64 Bit (Long Mode) on 64Bit Linux
Compiling a Linux Program for Arm Architecture - Running on a Host Os
How to Get Ec2 Load Balancing Properly Set Up to Allow for Real Time File Syncing
Merge/Join Two Tables Fast Linux Command Line