Skip to content

Instantly share code, notes, and snippets.

@KAllan357
Created May 3, 2013 20:50
Show Gist options
  • Save KAllan357/5513997 to your computer and use it in GitHub Desktop.
Save KAllan357/5513997 to your computer and use it in GitHub Desktop.
current_path = "C:/foo"
execute ::File.join(current_path, "start_my_thing.bat") do
only_if {
node[:my_thing][:running]
}
end
# [2013-05-01T17:30:12-07:00] INFO: execute[C:/foo/start_my_thing.bat] ran successfully
# MyThing.exe in Task Manager
# Chef Run ends -> MyThing.exe process dies.
@KAllan357
Copy link
Author

ruby_block "start the thing" do
  block do
    Process.create(
      app_name: ::File.join(current_path, "foo", "MyThing.exe"),
      creation_flags: Process::DETACHED_PROCESS | Process::CREATE_BREAKAWAY_FROM_JOB,
      cwd: ::File.join(current_path, "foo")
    )
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment