Running knife commands in the background(using rc.local)


I’ve written a rack application using grape which calls knife’s bootstrap
command to bootstrap a VM.The following is the code to bootstrap
module Chef
class Bootstrap < Grape::API
format :json
content_type :json,"application/json"
params do
requires :VM_IP, :type => String, :desc => "ip value"
requires :VM_username, :type => String, :desc => "username"
requires :VM_password, :type => String, :desc => "password"
resource :virtualmachine
post ‘bootstrap’ do
content_type "application/json"
status "200"
body “Boostrapped Successfully!!!”

t1 = do
     system "knife chefsolo bootstrap #{params[:VM_IP]} -x

#{params[:VM_username]} -P ‘#{params[:VM_password]}’"

When i start the app manually using “rackup -p 9000”,the above code
is working fine,I’ve added this command to /etc/rc.local file to start the
service during startup. The service has been started successfully but
bootstrapping is not working. I’ve tried replacing the knife commands with
other system commands and those are working fine.Only knife commands are not
working when i start the service in the background.Is there any specific reason
for it?How can i modify the code to make that working?