title: Chef execute fails for the first time
body: <p>I have a weird problem with a Chef Recipe. Let me tell you that I'm new to Chef so pardon me if something looks awfully wrong.</p>
  
  <p>I have my war file, which is built by Spring Boot. I just need to run <code>java -jar &lt;file&gt;.war -config=config/</code> to run my app.</p>
  
  <p>I recently started experimenting with Chef, and getting to write recipes that do this job.</p>
  
  <p>The code from my recipe is as follows:</p>
  
  <pre><code>#Some code has been omitted intentionally.
  
  directory "#{home}" do
    owner 'root'
    group 'root'
    mode '0755'
    recursive true
  end
  
  directory "#{home}/config" do
    owner 'root'
    group 'root'
    mode '0755'
  end
  cookbook_file "#{home}/config/ehcache.xml" do
    source "ehcache.xml"
    mode "0644"
  end
  # Get the war file from the repo
  remote_file "#{home}/app.war" do
     source "#{node['baseos']['files_repo_url']}/wars/app.war"
     owner 'root'
     group 'root'
     mode '0644'
  end
  
  execute 'Run the war file' do
    command "java -jar '#{home}/app.war' -config='#{home}/config/'"
    action :run
  end
  </code></pre>
  
  <p>The war file, and the related config folder along with its contents are successfully being copied to their respective destinations before the <code>execute</code> command gets fired. The problem is when the machine gets freshly created with <code>kitchen create</code>, the first <code>kitchen verify</code> would fail, saying <code>'Errno::ENOENT: No such file or directory - java -jar /opt/com/app.war -config=config/'</code>. 
  This only happens for the first time. Surprisingly, after saying <code>kitchen verify</code> again, the app starts up, and successfully runs.</p>
  
  <p>This is weird because of the fact that the required file app.war and the config/ are [or should be] already there in the machine with appropriate privileges.</p>
  
  <p>I know Chef processes these things sequentially, so given that the execute command is the very last line in my recipe, it should already have what is required to run the war file. I'm going nuts, can anyone provide some insight into this one?</p>
  
  <p>Thank you!</p>