tags:

views:

218

answers:

1

I am using Rightscale to launch an instance on Amazon EC2. All my boot scripts work great and do things like getting the below file names in the folders. The last boot script is the following:

#!/bin/bash

MAINDIR="/root/username/"    

ruby ${MAINDIR}insertfd_control.rb stop
ruby ${MAINDIR}insertfd_control.rb start
ruby ${MAINDIR}inserttk_control.rb stop
ruby ${MAINDIR}inserttk_control.rb start

I want to use it to start my daemons that I wrote in Ruby. It is run as a bootscript without the output of any errors but when I log in via ssh I see that they haven't been started. I then run the above script manually and they start. How come they aren't starting with the boot scrpipt?

I found the following post: http://blog.angelbob.com/posts/124 but I am not sure if it is relevant.

Thank you very much,

Cei

A: 

I discovered the answer due to the link to that blog post. The ruby control script needs to have an absolute path to the script.

e.g.

#!/usr/bin/env ruby

require 'rubygems'
require 'daemons'

options = {
  :app_name   => "inserttk",
  :log_output => true,
  :monitor    => true
}

Daemons.run('/root/username/inserttk.rb', options)